cancel
Showing results 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

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 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
Community Support

Hi @Anonymous ,

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

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.

4 REPLIES 4
Community Support

Hi @Anonymous ,

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

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.

Super User

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

please use Rank approach suggested in my blogs

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.

Super User

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

Announcements

#### 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 Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors