cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fab_incher
Frequent Visitor

RANKX for Rolling last 12 Month

Hi all,

 

I have some daily Data ('Implied Volatility', but only for working days) and i'm struggling to build a measure that gives me a rolling-1-year-Rank measure. If i dont select any Date(s) for row (e.g. in a card), it should show me the current Rank of last 1 year from today on.

 

Probably it is something like...

Rank = RANKX (

                   CALCULATETABLE(...),

                   [newColumnImpliedVolatility]

              )

 

Thanks for your help!

 

Implied Volatility Measure = CALCULATE(AVERAGE(Fact_UnderlyingDaily[ImpliedVolatility]))

 

Bild1.png

1 ACCEPTED SOLUTION
FreemanZ
Community Champion
Community Champion

hi @fab_incher 

try like:

Ranking =
VAR _date = MAX(TableName[Date])
RETURN
RANKX(
    CALCULATETABLE(
        ALLSELECTED(TableName[Date]),
        TableName[Date]<=_date,
        TableName[Date]>=EDATE(_date, -12)
     ),
    [Implied Volatility]
)

View solution in original post

2 REPLIES 2
fab_incher
Frequent Visitor

Hi @FreemanZ  thank you for your solution.

 

One Question: why do we need ALLSELECTED?

FreemanZ
Community Champion
Community Champion

hi @fab_incher 

try like:

Ranking =
VAR _date = MAX(TableName[Date])
RETURN
RANKX(
    CALCULATETABLE(
        ALLSELECTED(TableName[Date]),
        TableName[Date]<=_date,
        TableName[Date]>=EDATE(_date, -12)
     ),
    [Implied Volatility]
)

Helpful resources

Announcements
Exciting changes

Power BI Community Changes

Check out the changes to the Power BI Community announced at Build.

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Kudo Data Story carousel

Data Stories Gallery

Visit our Data Stories Gallery and give kudos to your favorite Data Stories.

Top Solution Authors