Hello!
I thought this would be easy even though there are lots of topics on this but my solution is far from perfect.
I want to calculate Previous Week to date, Current Week to date and the Variance between both.
I am sure I got the previous week correctly, following Sam example on this platform.
My query is like so:
`> Previous Week Total =
VAR _NowWeek = SELECTEDVALUE ( Dates[Week Number] )
VAR _NowYear = SELECTEDVALUE ( Dates[Year] )
VAR _MaxWeekNumber = CALCULATE ( MAX ( Dates[Week Number] ), ALL ( Dates ))
RETURN
SUMX (
FILTER ( ALL ( Dates ),
IF ( _NowWeek = 1,
Dates[Week Number] = _MaxWeekNumber && Dates[Year] = _NowYear - 1,
Dates[Week Number] = _NowWeek - 1 && Dates[Year] = _NowYear )),
[Total Cases]
)
I am unable to reproduce the same for Current Week(Current Week, in this case, may not typically be this week but across selected time frames)
`
My file is attached
PreviousNcurrent.pbix (300.3 KB)