Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Super User
Super User

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
Super User
Super User

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors