Hey Guys,
I’m trying to present a basic “Item Rank” based on an an item’s total sales using sqlbi’s ranking DAX pattern and I’m receiving duplicate ranks despite the quantities not being ties. I’m sure it’s something basic that I’m missing here.
Item Descr | Total Adj Sales | Item Rank |
---|---|---|
100-A | 258059.97 | 1 |
101-B | 238314.27 | 3 |
102-C | 158684.58 | 4 |
103-D | 230244.62 | 4 |
104-E | 158417.51 | 5 |
105-F | 154518.81 | 6 |
106-G | 154253.23 | 7 |
107-H | 148204.14 | 9 |
108-I | 151630.45 | 9 |
109-J | 147247.45 | 10 |
Total Adj Sales = SUM(FactTable[Adj Sales])
Item Rank =
IF (
ISINSCOPE( ItemDimTable[Item Descr] ),
VAR SalesAmountCurrentProduct = [Total Adj Sales]
VAR ItemRank =
RANKX(
ALLSELECTED( ItemDimTable ),
[Total Adj Sales]
)
VAR Result =
IF(
NOT ISBLANK(SalesAmountCurrentProduct),
ItemRank
)
RETURN
Result
)
Have you seen this behavior before? Any idea what’s going awry? Thanks in advance!
MK