Forum Discussion

Petan65's avatar
Petan65
Frequent Visitor
2 years ago
Solved

RANKX always returns 1

Hello,

 

I went throught a lot of threads about this topic but any of the solutions hasn't work. I probably know why it's not working, but I don't know how to fix it. The reason is because all 3 customers have the same number on some line in database and power BI is not taking ranking it from the total.  

 

 

 

  • Hi Petan65 
    Try to do it with 2 measures : 

    1. total sales = sum('Table'[Sales])
    2. 
    Customer ranked by Sales =
    RANKX(
        ALL('Table'[Customer]),
        [total sales]
    )
    Unfortunately, I am out of the limit of images that I can attach to discussions.
    So I prepared a sample PBIX, you can download it from This link 
    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
     
  • Hi Petan65 
    The card can't be filtered because it doesn't have a row context, unlike tables which are filtered by rows (categories), graphs which have this on axes, etc...
    What do you want from card to show? There is no card on the linked file...

6 Replies

  • Hi Petan65 
    Try to do it with 2 measures : 

    1. total sales = sum('Table'[Sales])
    2. 
    Customer ranked by Sales =
    RANKX(
        ALL('Table'[Customer]),
        [total sales]
    )
    Unfortunately, I am out of the limit of images that I can attach to discussions.
    So I prepared a sample PBIX, you can download it from This link 
    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.