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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
shamsMQ
New Member

Week on Week change by Calculation Group

I am using this code to determine the week-on-week change in the calculation group. The requirement is similar to any other week-on-week change visualization function only I want to compare last week's closing value with this week's closing value. 
 
Current | Previous Week =
Var _CurrentWeek=ROUNDUP(CALCULATE(SELECTEDMEASURE(),LASTDATE(Clubbed_Data_Raw[Date])),0)
VAR_PreviousWeek=ROUNDUP(CALCULATE(SELECTEDMEASURE(),Clubbed_Data_Raw[Week]=max(Clubbed_Data_Raw[Week])-1,Clubbed_Data_Raw[Date]=MAX(Clubbed_Data_Raw[Date]),Clubbed_Data_Raw[Year]=MAX(Clubbed_Data_Raw[Year])),0)
RETURN
FORMAT(_CurrentWeek,"#,###")&" | "&FORMAT(_PreviousWeek,"#,###")
 
But executing this code showing me blank value in the PreviousWeek column in the matrice. Need help on this. 
2 REPLIES 2
Shahid12523
Community Champion
Community Champion

Your PreviousWeek is blank because filter conditions weren’t applied correctly.
Fix with FILTER(ALL()) instead of direct column conditions:

 

VAR _PreviousWeek =
CALCULATE (
SELECTEDMEASURE(),
FILTER (
ALL ( Clubbed_Data_Raw ),
Clubbed_Data_Raw[Week] = MAX(Clubbed_Data_Raw[Week]) - 1 &&
Clubbed_Data_Raw[Year] = MAX(Clubbed_Data_Raw[Year])
)
)

Shahed Shaikh
OktayPamuk80
Responsive Resident
Responsive Resident

Hi,

this is the wrong blog. For Power BI there is another community group. However, you might use visual calculations, by which you might achieve a your requirement:

 

https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview

 

Regards,
Oktay

 

Did I answer your question? Then please mark my post as the solution.

If I helped you, click on the Thumbs Up to give Kudos.

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Free Fabric Certifications

Free Fabric Certifications

Get Fabric certified for free! Don't miss your chance.

January Fabric Update Carousel

Fabric Monthly Update - January 2026

Check out the January 2026 Fabric 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.