Forum Discussion

collinq's avatar
collinq
Super User
5 years ago
Solved

Rankx Issue

Hi all, This is a bit embarrassing, but, frankly, I have now confused myself by trying so many variations .  I thought this would be easy but obviously I am missing something.  I want to rank my cus...
  • edhans's avatar
    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.