Forum Discussion
Choose data, display current week data as well as previous week
Hi Guys,
based on a selected date (week) in a slicer (SlicerWeek), I want to display in a table the value of the week, as well as the previous week value.
The columns of the table contain the date, formatted as week.
There is a date table, linked to a fact table.
In the screenshot you can see the desired result of the table, but I want to select only one week in the Week Slicer and display tow weeks data (there are other visuals that show only the current week value).
Regards,
Toddy
4 Replies
- amitchandak
Super User
Anonymous , Refer if my WOW blogs can help you
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8or if want select one period and want to show more than that , then use independent date tbale
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
- AnonymousNot applicable
hey, amitchandak
Thanks for these very helpful links, but I'm still struggeling with the link to the chosen slicer / week. I'll try to have a dynamic previous week, not the previous week to the actual date
I have already a measures defined
z_Day_Worked_CW-1 = CALCULATE( [z_Day_Worked], DATEADD('DIM_Calendar'[CAL_CalendarDay], -7, DAY) )Maybe only the filtering is my problem...
- amitchandak
Super User
Anonymous , if you want to select a week, the above links can help. But if you want based on today
This Week today =
var _st = today() +-1*WEEKDAY(today(),2)+1 //monday week
var _end =today()+ 7-1*WEEKDAY(today(),2)
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filter
Last Week today =
var _st = today() +-1*WEEKDAY(today(),2)+1 -7 //monday week
var _end =today()+ 7-1*WEEKDAY(today(),2) -7
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filtersunday week
today() +-1*WEEKDAY(today(),1)+1