Forum Discussion

Balaraju's avatar
Balaraju
Icon for Helper III rankHelper III
4 years ago
Solved

Need to get store Rank based on Store Type

Hi All,

 

I hope all are doing good,

 

I have one requirement, where I need to get store ranking based on store type. Below I have attached the POC with the required output.

For eg: If I have Store X, Y, and W under store type A I need to get the ranking of a particular store under store type A and also the same for stores under store type B.

 

 

Please help me out with this.

 

Thanks,

Balaraju

 

  • Hi Balaraju ,

    According to your description, here's my solution.

    Create two calculated colulmns.

     

    Under A Store Rank =
    IF (
        'Table'[Store Type] = "A",
        RANKX ( FILTER ( 'Table', 'Table'[Store Type] = "A" ), 'Table'[Sales] ),
        0
    )
    
    Under B Store Rank =
    IF (
        'Table'[Store Type] = "B",
        RANKX ( FILTER ( 'Table', 'Table'[Store Type] = "B" ), 'Table'[Sales] ),
        0
    )
    

    Or you can do it in a single column.

    Column =
    RANKX (
        FILTER ( 'Table', 'Table'[Store Type] = EARLIER ( 'Table'[Store Type] ) ),
        'Table'[Sales]
    )
    

     

    Get the correct result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

2 Replies

  • Hi Balaraju ,

    According to your description, here's my solution.

    Create two calculated colulmns.

     

    Under A Store Rank =
    IF (
        'Table'[Store Type] = "A",
        RANKX ( FILTER ( 'Table', 'Table'[Store Type] = "A" ), 'Table'[Sales] ),
        0
    )
    
    Under B Store Rank =
    IF (
        'Table'[Store Type] = "B",
        RANKX ( FILTER ( 'Table', 'Table'[Store Type] = "B" ), 'Table'[Sales] ),
        0
    )
    

    Or you can do it in a single column.

    Column =
    RANKX (
        FILTER ( 'Table', 'Table'[Store Type] = EARLIER ( 'Table'[Store Type] ) ),
        'Table'[Sales]
    )
    

     

    Get the correct result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

    • Balaraju's avatar
      Balaraju
      Icon for Helper III rankHelper III

      It's working thank you very much