Yatz86
September 18, 2019, 4:14am
1
Dear all,
In reference to the link of the original post below, would there be a way to branch this measure out to support WK number & Day of Last year?
Link to Original Post:
I am trying to create a expression to compare sameperiodlastyear at a fiscal week level.
The calculation I tried (below) does not return the correct value.
Total Sales LY = CALCULATE( [Total Sales], SAMEPERIODLASTYEAR( Dates[Date] ) )
My data is at a fiscal week level, and does not have standard calendar dates
For example, I need to compare Fiscal Week 201701 to Fiscal Week 201601, but the fiscal week begins in February. I would like the calculation to be dynamic so that I can look at last 2…
From the original measure of PY Sales Setup, I tried to add ‘Date’[DayInWeek] as a new variable but the outcome was not what I wanted. Below screenshot for reference.
Modified Measure
Modified Outcome
Advance thanks for the help all!
Regards
Hidayat
Have you had a look through these example below for ideas
Sam
Yatz86
October 2, 2019, 6:50am
3
Hi @sam.mckay ,
Yea, had a look at the videos.
Turns out, all it took was a moment to sit down and a good cup of coffee.
Here is my solution for Year & ISOWeek & Day Comparison:
Create a calculated column for Year & Week & Day in Date Table.
Year & Week & Day = ‘Date’[Year] &“-”&‘Date’[Week No.] &“-”&‘Date’[DayInWeek]
After which, create a calculated column to sort “Year & Week & Day” as such:
YearWeekDaySort = ( ‘Date’[Year] * 10000 ) + (‘Date’[Week No.] * 100) + ‘Date’[DayInWeek]
Next, proceed to create a measure:
PY Setup Pairs Sold =
VAR CurrentDay = SELECTEDVALUE ( ‘Date’[DayInWeek] )
VAR CurrentWeek = SELECTEDVALUE ( ‘Date’[Week No.] )
VAR CurrentYear = SELECTEDVALUE ( ‘Date’[Year] )
RETURN
CALCULATE( [PAA Sold], FILTER( ALL(‘Date’), ‘Date’[DayInWeek] = CurrentDay && ‘Date’[Week No.] = CurrentWeek && ‘Date’[Year] = CurrentYear - 1 ) )
Last, use this measure to get the subtotal in the PY measurement.
PY Pairs Sold =
SUMX(
SUMMARIZE( ‘Date’, ‘Date’[Year & Week], ‘Date’[Week No.],‘Date’[DayInWeek],
“LY Sales”, [PY Setup Pairs Sold] ),
[LY Sales] )