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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
sergioquerido
Helper I
Helper I

Calculate the max value reached in previous weeks (current week not included)

Hello,

I would like to calculate the difference between the MAX value reached in current week and the MAX value reached in previous weeks (current week not included). I am using a WEEKRANK measure to identify weeks and i created the following code. However I do not know how to exclude the current week from the "allweeks" variable.

 

%CHANGE_MS = 
VAR thisweek = CALCULATE(MAX(GPS[Max. Speed]),FILTER(ALLEXCEPT(GPS,GPS[Player Nickname]), GPS[WEEKRANK]=MAX(GPS[WEEKRANK])))
VAR maxweek = MAX(GPS[WEEKRANK])

VAR allweeks = CALCULATE(MAX(GPS[Max. Speed]), ALLEXCEPT(GPS, GPS[Player Nickname]))
RETURN

DIVIDE(thisweek-allweeks,allweeks)

Thanks in advance!

 

SQ

1 REPLY 1
lbendlin
Super User
Super User

if your WEEKRANK starts from 1 then exclude 1 from the list?

 

Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors