Forum Discussion

HanhLe's avatar
HanhLe
Frequent Visitor
1 year ago

RANKING VALUE

Hi everyone,

I want to make a ranking of product type for each lines follow these description, but I got wrong result, hope to receive your help, thanks

 

10 Replies

  • Hi, 
    You need to remove filters on whatever A02, A03 is (products?) so that RANK evaluates over the entire product type and not just over each product. So something like:

     

    Rank = 
    RANKX(
        ALL(Products[Product]),
        [Average of PPH], //Or whatever measure you want to rank by
        ,
        DESC
        )

     

    Try it out and if it doesn't work you can give some more info on how the data is structured and what measures you have been trying so I can give you more specific advice.

     

    Good luck!

    • HanhLe's avatar
      HanhLe
      Frequent Visitor

      Hi Tomas, 

      Thanks for your advice, maybe I did not descripe clearly about what result I want to have so let me adjust my BIs visual, I want to rank top PPH line produce each product type, and please consider that 1 line can produce multiple product type.

      This analysis can help me know that for each product type, which line produce better. Kindly help to check, thanks a lot

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi HanhLe , hello TomasAndersson, thank you for the prompt reply!

        Check the following measure:

        Top PPH = 
        VAR CurrentProductType = SELECTEDVALUE('Table'[Product Type])  
        VAR CurrentLine = SELECTEDVALUE('Table'[Line])               
        
        RETURN
            RANKX(
                FILTER(
                    ALL('Table'),                                   
                    'Table'[Product Type] = CurrentProductType      
                ),
                CALCULATE(SUM('Table'[PPH])),                                       
                ,
                ASC,                                                  
                DENSE                                                
            )
        

         Result:

        Best regards,

        Joyce

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