Forum Discussion

aquanr18's avatar
aquanr18
Frequent Visitor
7 years ago
Solved

Creating a Rank for each Item By Custumer

Hi! tnx a lot for reading my post, 

My goal is to obtain the row TOP in powerr bi using rankx, 

 

 

 

 

 

 

 

 

 

 

 

 

This is a rank for each item by customer in the same table. 

My data model looks like this. 

 

 

any Help will be much appreciated, 

Thanks!

  • aquanr18 Please try this as a "New Column"

     

    Top = RANKX(FILTER(Test58Rank,Test58Rank[Client]=EARLIER(Test58Rank[Client])),Test58Rank[Sales],Test58Rank[Sales],DESC)

9 Replies

  • I guess you wanna do it as a calculated column:

     

    Ranking = 
        VAR Sls = Sales[Sales]
    RETURN
        CALCULATE(
            RANKX( 
                Sales, 
                Sales[Sales],
                Sls
            ),
            ALLEXCEPT( Sales, Sales[Cliente] )
        )
    • aquanr18's avatar
      aquanr18
      Frequent Visitor

      Hi! thanks ! but the formula has something wrong
      I got the error "A single value form column 'Sales' in the table 'Sales' cannot be determined. This can happen when a measure formula refers to a column that contains many values without an aggregation such as min, max, count or sum to get a single result'

       

      I tryed to agreggate the sales by SUM but got nothing out of the formula. 

      What should I do?