Forum Discussion
Rankx Issue
- 5 years ago
Ok collinq - I am not seeing something. When I do a simple RANKX, I am getting some groupings I don't understand, and rank 8 is missing.
I don't know why it is doing that. Perhaps someone a bit better at DAX would see the issue. TomMartens Greg_Deckler perhaps.
That issue aside, the following measure does rank based on the dates selected in the slicer (see file attached) but again with a few skipped items and a few grouped together.ALLSELECTED RankX = RANKX( ALLSELECTED(Margin), [Total Gross Margin] ) Total Gross Margin = SUM(Margin[Gross Margin])For example, selecting April shows this:
I cannot for the life of me figure out where ranked item #2 went. I know why #4 is repeated - same value, But not why #7 is repeated.
Here is my PBIX file. All data is in it, no need to connect to outside files. I had to clean your data up a bit collinq - there was no customer 4661 in your customer table, so filtered that out, and got rid of all zeros and blanks for testing.
Hi edhans ,
I have place a sample file here: https://pmps1-my.sharepoint.com/:x:/g/personal/cquiring_epmstrategy_com/EUguVdh5Ai9JkjRQ0nMJ07UByX2Tj6-Zlk81dH2nPo_b3Q?e=fXL906
I am linking "DateField" in Date to "ApplyDate" in InvcHead.
Thanks!
collinq if you want a rank according to customers, the first parameter of RANKX should be a table of customer id.
try this.
GM_Rank:=CALCULATE(RANKX(ALL(Customers[CustID]),CALCULATE(SUM(InvcHead[Gross Margin]))),ALLSELECTED(DateTable[Date]))