cancel
Showing results for
Did you mean:
Frequent Visitor

## Percentage difference for displayed week and week before of the display week

Hello,

I have weekly data as below for 3 years period and trying to create a measure that gives me a percentage difference with the previous time period (for example if I put data by QTR/Month/year)

Input Data -

Desired Output -

Is there any way to create this measure dynamic that works if drilled on the Month/Quarter/Year level on the visual? I have a normal table as below with SUM in it but we want it to be replaced by the percentage difference.

1 ACCEPTED SOLUTION
Community Support

Try this measure, Quarter, week, etc. are written similarly.

``````aa =
VAR _lastyear =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Month] ),
YEAR ( [Date] )
= YEAR ( MAX ( 'Table'[Date] ) ) - 1
)
)
VAR _thisyear =
SUM ( 'Table'[Value] )
RETURN
DIVIDE ( _thisyear - _lastyear, _lastyear )
``````

Best Regards,

Stephen Tao

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

5 REPLIES 5
Super User I

Just change the Previousweek Variable Measure to which is mentioned the video

MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!

Frequent Visitor

ok so I just got something after using ALLSELECTED in the filter but still, I'm not able to get the correct total at the bottom?

Super User I

For Question 1 Watch this Video at 17:46 , where I have explained to see the week over week vairance analysis

For the second question, is it possible to share some smaple data without any sensitive information

MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!

Frequent Visitor

Can we create any measure with percentage difference comparing all 3 years ( 2019,20,21) on Month, Week, Quarter, Year level? like below.

Community Support

Try this measure, Quarter, week, etc. are written similarly.

``````aa =
VAR _lastyear =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Month] ),
YEAR ( [Date] )
= YEAR ( MAX ( 'Table'[Date] ) ) - 1
)
)
VAR _thisyear =
SUM ( 'Table'[Value] )
RETURN
DIVIDE ( _thisyear - _lastyear, _lastyear )
``````

Best Regards,

Stephen Tao

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

Announcements