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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
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.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.