Forum Discussion

clewisWB's avatar
clewisWB
Frequent Visitor
2 years ago
Solved

Power BI slicers, Dates and Ranks

I have 1 slicer slecting 2024 and a second selecting April from a calendar which is linked to my main table

I have the following Measure

 

RankxSelected =
RANKX(
    ALLSELECTED(consolidated_reporting_data[positionNovusSecurityName.value]),
    CALCULATE([Total PnL %]), , DESC, Dense)

 

The following table is the output

Name pnl long/Short RankxSelected
stockA 20 L 1
stockB 19 L 2
stockC 18 L 3
stockD 17 S 1
stockE 16 L 4
stockF 15 S 2
stockG 14 S 3
stockH 13 S 3
stockI 12 L 5
stockJ 11 L 6
stockK 10 S 4
stockL 9 L 7

 

I am trying to get the following

Name pnl long/Short RankxSelected
stockA 20 L 1
stockB 19 L 2
stockC 18 L 3
stockD 17 S 4
stockE 16 L 5
stockF 15 S 6
stockG 14 S 7
stockH 13 S 8
stockI 12 L 9
stockJ 11 L 10
stockK 10 S 11
stockL 9 L 12

 

Any ideas to help would be great thank you

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi clewisWB 

     

    I've made a little change to your measure and it should work for you.

    RankxSelected =
    RANKX(
        ALL(consolidated_reporting_data[positionNovusSecurityName.value]),
        CALCULATE([Total PnL %]), , DESC, Dense)

     

     

     

     

     

    Best Regards,

    Jayleny

     

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

    • clewisWB's avatar
      clewisWB
      Frequent Visitor

      Hi, thanks for the reply.

       

      The change makes no difference to the output

       

      The value of the Long/short column seems to be where the rank "restarts" and am unsure how to overcome that