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 over week measures giving two very different results

Hello Community  -  I am trying to diagnose why the results of these two different 'week over week' formulas are so different.  

 

In the first measure (which I know is correct) I am using a fully qualified column reference.    In the second formula, I am using a sumx measure.    You can see in my table that a change from 38 units returned in Week 33  to  52 units returned in Week 34, is indeed  a 36.84% change.  

 

Just trying to figure out what is wrong with that 2nd formula as I'd like to make use of the VAR functions.  

 

 

week over week .jpg

 

Week over Week Qty Change =
VAR lastWeekAmount =
CALCULATE (
SUM ( Merge1[Qty To Return] ),
FILTER (
ALL ( 'Date Table' ),
'Date Table'[Week Number]
= MIN ( 'Date Table'[Week Number] ) - 1
)
)
RETURN
DIVIDE ( SUM ( Merge1[Qty To Return] ) - lastWeekAmount, lastWeekAmount, 0 )

 

-----

 

Week over Week2 =
VAR CurrentWeek = SELECTEDVALUE('Date Table'[Week Number])
VAR CurrentYear = SELECTEDVALUE('Date Table'[Year])
VAR MaxWeekNumber = CALCULATE(MAX('Date Table'[Week Number]), ALL('Date Table'))
RETURN
SUMX(FILTER(ALL('Date Table'),
IF(CurrentWeek = 1,'Date Table'[Week Number]=MaxWeekNumber && 'Date Table'[Year]=CurrentYear - 1,'Date Table'[Week Number]=CurrentWeek - 1 && 'Date Table'[Year]=CurrentYear)),[SumX Qty to Return])
1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have modified your second formula . Please refer to my .pbix file.

v-lionel-msft_0-1599112233059.pngv-lionel-msft_1-1599112252707.png

 

Best regards,
Lionel Chen

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

View solution in original post

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have modified your second formula . Please refer to my .pbix file.

v-lionel-msft_0-1599112233059.pngv-lionel-msft_1-1599112252707.png

 

Best regards,
Lionel Chen

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

amitchandak
Super User
Super User

@Anonymous , when are not using year, it can week across year?

 

please use Rank approach suggested in my blogs

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-Last-Week/ba-p/1051123

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak    Hi Amit  -  I am not totally clear on your question.  

 

But if I do not have a year filter....so instead use a relative date  (past 30 days for example), I still get the same issue.   One formula works and one does not.  

@Anonymous , in the first formula you are using week number only. Same week number can be there across the year.  So I doubt that answer will match with one formula use year.

 

Check if my Rank approach can help you.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

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.