Forum Discussion

bgonen6899's avatar
bgonen6899
Regular Visitor
1 year ago
Solved

Rank by 2 groups and sort by MoveInScore

 

I am trying to create a DAX formula :

If Response Movein% is greater than 0.18 then Group 1 

If Response Movein% is less than 0.18 then Group 2

Within Group 1 Rank (in DESC order) by MoveInScore.

Then continue the rank Group 2

My Goal is to get the end result of the far right column

 

Pr_Prop_CodeGroupMoveInScoreResponse Movein %Rank
213501525.00%1
212651525.00%2
111581528.60%3
302231522.20%4
1083214.540.00%5
2125414.537.50%6
2024114.3321.40%7
2115614.3325.00%8
1013114.3325.00%9
1060114.2522.20%10
108942516.00%11
10451250.00%12
3048024.9213.30%13
1061424.9117.20%14
1069924.815.00%15
2037024.817.10%16
2132624.750.00%17
1043224.7511.10%18
2131824.654.80%19
1013724.4315.20%20
1083024.3314.30%21
1024524.338.10%22
2046324.3315.00%23
2017724.296.90%24

4 Replies

  • why 21350 is the first and 21265 is the second? they are in the same group and have the same moveinsocre and same response movein%

    • bgonen6899's avatar
      bgonen6899
      Regular Visitor

      Ideally it should look like below:

      MoveinScore determines the main ranking (then if possible, to rank by the Respone Movein %)

       

       

    • bgonen6899's avatar
      bgonen6899
      Regular Visitor

      Thank you so much Thxalot

      This is awesome. great help.

       

      I modified your formula slightly (because the Response Rate and Score are DAX measures.

      This is the modified formula I used:

       

      Rank by GroupsAB by Movein Score by Movein Response % =
      VAR _prod =
          ALLSELECTED(Property_Unit[Pr_Prop_Code])

      RETURN
          RANKX(
              _prod,
              CALCULATE(
                  (IF([Response Movein %] > 0.18, 1, 0)) * 100 + [AvgMoveInsScore],
                  ALLEXCEPT(Property_Unit, Property_Unit[Pr_Prop_Code])
              )
          )