Forum Discussion

sizi's avatar
sizi
Icon for Helper II rankHelper II
2 years ago

DAX to define Overall rank based on 2different Ranks

Hello All,

 

I need to define rank for each employee based on average of 2 defined ranks.

 

Below is the original data:

EmployeeTaskRankSLAAvg(Task+SLA)
John232.5
claire423
Chris444
Rock264
Bella634.5
Harry714
Stefanie153

The result overall rank shall be based on Avg values:

EmployeeTaskRankSLAAvg(Task+SLA)Overall Rank
John232.51
claire4232
Chris4443
Rock2643
Bella634.54
Harry7143
Stefanie1532

 

Kindly help. Thanks in advance.

 

9 Replies

  • sizi 

    Create a caluclated Column:

    Rank = RANKX( SUMMARIZE(ALL(Table),Table[Employee],Table[Avg(Task+SLA)]) ,Table[Avg(Task+SLA)] ,,ASC,Dense)





    • sizi's avatar
      sizi
      Icon for Helper II rankHelper II

      Avg column is a measure. The above dax is giving error because of that.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi sizi ,

     

    If you want to use measure, try it:

    Measure = var _t = ADDCOLUMNS('Table',"Rank",RANKX(ALL('Table'),'Table'[Avg(Task+SLA)],,ASC,Dense))
    RETURN MAXX(_t,[Rank])

     

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

    • sizi's avatar
      sizi
      Icon for Helper II rankHelper II

      It showing 1 for all the employees.

       

      • Fowmy's avatar
        Fowmy
        Icon for Super User rankSuper User

        sizi 

        Use this measure:

        Rank BA Avg = 
        IF(
            ISINSCOPE( Table35[Employee]),
            RANKX( 
                ADDCOLUMNS( ALL(Table35) , "Avg" , [BA Avg] ),
                [BA Avg],,
                ASC,
                Dense
            )
        )

         

         

    • sizi's avatar
      sizi
      Icon for Helper II rankHelper II

      all the 3 columns are measures defined fyi.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi sizi ,

     

    Try the following expression:

    Rank = var _t = ADDCOLUMNS('Table',"Rank",RANKX(ALL('Table'),[AVG],,ASC,Dense))
    RETURN MAXX(_t,[Rank])

     

    An attachment for your reference. Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

    • sizi's avatar
      sizi
      Icon for Helper II rankHelper II

      It isnt working for me. Task rank, sla rank is all measure defined from measures. I dont know the dax doesnt work for me 😞

    • sizi's avatar
      sizi
      Icon for Helper II rankHelper II

      Below is the data detaile data and how  the calculation is done. Task rank is defined based on total task ; Avg sla is sla complaint task against task qulaified for SLA out of Total task and the result is defined rank and then task rank + sla rank gives the overall avg which again is defined to get the final rank.

      EmployeeTotal Task TaskRankTask Qualified for SLASLA Complaint Task out of QualifiedAvg of sla complaint Avg SLA rank Total Rank Avg (TaskRank+AvgSLARankFinal Rank
      John2717342.85714286322
      claire1645240444
      Chris222548011.51
      Rock145635023.55
      Bella1166350246
      Harry573133.33333333567
      Stefanie193425022.53