Forum Discussion
Tan_Bui
6 years agoNew Member
WTD Last Year
Dear experts, I have used this function for WTD this year and it works perfectly. I tried this to WTD last year and it always returns blank. Then I tried to delete the last fitler Date < Sameday la...
- 6 years ago
Tan_Bui , refer to my blog. I have not last year there , but you can try these two calculation
LYWTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52) && 'Date'[Weekday] <=max('Date'[Weekday]))) Or LYWTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=(max('Date'[Year]) -1) && 'Date'[Week Number]=(max('Date'[Week Number])) && 'Date'[Weekday] <=max('Date'[Weekday])))Please Watch/Like/Share My webinar on Time Intelligence: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
My Youtube Tips at: https://www.youtube.com/playlist?list=PLPaNVDMhUXGYrm5rm6ME6rjzKGSvT9Jmy
Appreciate your Kudos.
Tan_Bui
6 years agoNew Member
v-gizhi-msft thanks a lot for your thorough instructions including the pbix file. Appreciate that.
However, I used the card to display the last year WTD and it would show blank.
v-gizhi-msft
Community Support
6 years agoHi,
Please try this:
WTD(Last Year) =
SUMX (
DISTINCT ( 'Table'[Date] ),
CALCULATE (
IF (
YEAR ( MAX ( 'Table'[Date] ) )
= YEAR ( TODAY () ) - 1,
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[WeekNum] IN FILTERS ( 'Table'[WeekNum] )
&& 'Table'[Date] <= MAX ( 'Table'[Date] )
)
)
)
)
)
The result shows:
See my attached pbix file.
Best Regards,
Giotto