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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors