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.
If you could give us some data to work with it would be helpful. You've pasted some numbers above, but there are no dates, and the format is wonky. I could fix it, but with no dates, we are missing a key component of your ask. See links below for providing data and expected output.
How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.
- collinq5 years agoSuper User
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!
- wdx223_Daniel5 years agoCommunity Champion
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]))