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
Lynzmaz
Regular Visitor

Weekly sales variance % format Measure

Hi there,

 

I have spent many many days trying to get a measure to work to compare this week vs last week net sales in % format per store. Not sure if my calendar is set up wrong or where is the problem. Please help!!!! 

Lynzmaz_0-1635734823001.png

 

Thanks so much!

 

7 REPLIES 7
v-henryk-mstf
Community Support
Community Support

Hi @Lynzmaz ,

 

Sorry, it seems that the link you shared cannot be opened because there are no corresponding permissions. Could you share it again by another way.

 

Looking forward to your reply.


Best Regards,
Henry

 

v-henryk-mstf
Community Support
Community Support

Hi @Lynzmaz ,

 

According to your description, a separate calendar table needs to be created. Then create another column to find the number of days of the week corresponding to the date. The measure created to find the difference between the two weeks corresponds to the following reference:

Num = WEEKNUM('calendar'[Date],2)
M_ = 
VAR a =
    WEEKNUM ( TODAY (), 2 )
RETURN
    CALCULATE ( SUM ( 'Table'[Value] ), a = 'calendar'[Num] )
        - CALCULATE ( SUM ( 'Table'[Value] ), a = 'calendar'[Num] - 1 )

vhenrykmstf_0-1635908325471.pngvhenrykmstf_1-1635908362136.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Do you have a Calendar Table with a week number column?  If not, please create one.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Lynzmaz , Create a date table with following columns

 

new columns
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format

 

then create  measures
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

 

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit,

 

I have followed the steps but it is still not pulling the information. Where have I gone wrong?

Yes, I do have a calendar with week numbers already. I don't think the week rank is working.

Lynzmaz_0-1636354836150.png

Could I send the .pbix file for you to review?

Thanks

Hi @Lynzmaz ,

 

You can share the link to your pbix file and I will answer it for you as soon as possible.


Best Regards,
Henry

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