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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RochelReyes
Frequent Visitor

Getting the previous value of a measure using Date(year) as a criteria

Hi Everyone,

 

I would like to ask for your help on computing for the previous value of a measure.
I have a table that looks like this:

RochelReyes_1-1707734344519.png

To give context on this, the values above are base on the total score that are our exhibitors per event year are giving us which has the following formula 

NPS_score = ((CALCULATE(DISTINCTCOUNT(research_kpi[responseid]), research_kpi[NPSgroup] = "Promoters (9-10)")
                / CALCULATE(DISTINCTCOUNT(research_kpi[responseid]), research_kpi[NPSgroup] <> BLANK()))
            -
        (CALCULATE(DISTINCTCOUNT(research_kpi[responseid]), research_kpi[NPSgroup] = "Detractors (0-6)")
                 / CALCULATE(DISTINCTCOUNT(research_kpi[responseid]), research_kpi[NPSgroup] <> BLANK()))

) * 100


What I would like to attain is the previous value of the previous year just like this table:

RochelReyes_2-1707734572751.png

I tried using this formula

PreviousNPSScore = CALCULATE([NPS_score], FILTER(research_kpi, research_kpi[year] = PREVIOUSYEAR(research_kpi[year])))
but I am getting no values at all.

May I know if there is a workaround on this?

Thank you.

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

This looks like a good candidate for OFFSET.

 

Try this:

PreviousNPSScore =
CALCULATE (
    [NPS_score],
    OFFSET (
        -1,
        ORDERBY ( research_kpi[Year], ASC )
    )
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

This looks like a good candidate for OFFSET.

 

Try this:

PreviousNPSScore =
CALCULATE (
    [NPS_score],
    OFFSET (
        -1,
        ORDERBY ( research_kpi[Year], ASC )
    )
)

Thank you so much for this. This has been solved๐Ÿ˜Š

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)