Forum Discussion

ngocnguyen's avatar
ngocnguyen
Helper IV
3 years ago

Rankx run wrong result

Hi

I set up 2 below measures:

Rankx item = RANKX(ALL('STO Data'[Item]),[STO Amt],,DESC)
Rankx Cat and route =
Var bangao =CROSSJOIN(ALL('STO Data'[PL Cat]),ALL('STO Data'[Route]))
Return
RANKX(bangao,
CALCULATE([STO Amt],ALL('STO Data'[Item]))
,,DESC)
 
However, When I create 2 matrix as below. the "Rankx Cat  and route" give different results  (  matrix 1: result for Rac HN-HCM is 1, but matrix 2 is 2)
So, is there any issue with my measure?. Pls support to help

 

4 Replies

    • ngocnguyen's avatar
      ngocnguyen
      Helper IV

      Hi amitchandak 

      Thanks for your support.

      I re-buid the formulas as below. But it not working. Still  show wrong result

      Rankx Cat and route =
      CALCULATE(RANKX(ALLSELECTED('STO Data'[PL Cat],'STO Data'[Route]),[STO Amt],,DESC,Dense),ALL('STO Data'[Item]))

       

       

    • ngocnguyen's avatar
      ngocnguyen
      Helper IV

      Hi Thennarasu_R 

      No. I just working on 1 table " STO Data" only, no relationship.

       

      I just wanna create a matrix that having 5 column:" PL cat, Route, Item, Rankx Cat and route, Rankx item"

      Rankx Cat and route =
      CALCULATE(RANKX(ALLSELECTED('STO Data'[PL Cat],'STO Data'[Route]),[STO Amt],,DESC,Dense),ALL('STO Data'[Item]))
      Rankx item = RANKX(ALL('STO Data'[Item]),[STO Amt],,DESC)

       

      But, it not working. Pls support me