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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

week on week change

Hello experts! 

I have been following youtube tutorials on how to calculate a week on week change in a metric. And what I am getting does not work. Please help me to find out what I am doing wrong.

 

I have metrics:

WeekstartDate = 'invoices_granular'[createdAt]+-1*WEEKDAY(invoices_granular[createdAt],2)+1
and
WeekEndDate = invoices_granular[createdAt]+7-1*WEEKDAY(invoices_granular[createdAt],2)
and
WeekNum = WEEKNUM(invoices_granular[createdAt])
and
WeekRank = RANKX(ALL(invoices_granular),invoices_granular[WeekstartDate],,ASC,Dense)
and
Sales This Week = CALCULATE(SUM(invoices_granular[items.netRevenue]),FILTER(ALL(invoices_granular),invoices_granular[WeekRank]=MAx(invoices_granular[WeekRank])))
and
Sales Last Week = CALCULATE(SUM(invoices_granular[items.netRevenue]),FILTER(ALL(invoices_granular),invoices_granular[WeekRank]=MAX(invoices_granular[WeekRank])-1))
 
 
What I am getting does not make sense. 
The numbers do not add up and this gives me sales for Mon-Friday only, which does not match. The error is in the Sales this and last week calculation, and possibly somewhere in dates.
 
Screenshot 2023-10-04 at 18.38.27.png
 
 
 
The actual numbers should be as follows
 
Screenshot 2023-10-04 at 18.44.40.png
 
How do I make sales apprear for the week number and a week before that week number?
2 REPLIES 2
audreygerred
Super User
Super User

Here are two great sources for helping with week based time intelligence:

https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/

Week-related calculations – DAX Patterns





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

Hi @audreygerred , I had a read through both of these articles and this is beyond my skill unfortunately. I was hoping to fix what I have currently shown rather than redo it

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.