Forum Discussion
Graph Last 12 Weeks based on Week Slicer selection
TomBLG , Based on what I got
if you select a date and want to display more than that, you need independent date table
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = _max -84
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Also, check
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=pnAesWxYgJ8
Hi amitchandak,
Unfortunately I wasn't able to get to the solution I need with your measure nor with the links provided. Despite the new Date1 table (which I named Calendar1), it will still display just the week selected:
Another matter is the fact that this is only displaying properly on the area charts. For a bar chart, it will display all Metrics and instead highlight just the selected one, rather than simply showing the selected metric.
I suspect that rather than doing this:
new measure =
var _max = maxx(allselected(Calendar1),Calendar1[Date])
var _min = _max -84
return
calculate( [KPI Selection], filter('Calendar', 'Calendar'[Date] >=_min && 'Calendar'[Date] <=_max))I need to somehow integrate this measure in that one instead of calling [KPI Selection] in the calculate:
KPI Selection =
SWITCH(
TRUE(),
VALUES('KPI_Table'[KPI]) = "Metric 1", SUM('Hourly'[Metric1]),
VALUES('KPI_Table'[KPI]) = "Metric 2", SUM('Hourly'[Metric2]),
VALUES('KPI_Table'[KPI]) = "Metric 3", SUM('Hourly'[Metric3]),
VALUES('KPI_Table'[KPI]) = "Metric 4", SUM('Hourly'[Metric4]),
VALUES('KPI_Table'[KPI]) = "Metric 5", SUM('Hourly'[Metric5]),
BLANK ()
)If you see where the problem is and could change and send the pbix file back I would appreciate it immensely: