Forum Discussion
Show Current and Last Week values into chart
In this case, less may be more. Please try this one. If not, please paste the values from your image so I can try it out directly.
That measure didn't work for me.
I copy a table with the sample data.
| week_report | week_incident_open | value |
| 6/4/2020 | 23/12/2019 | 4 |
| 6/4/2020 | 10/2/2020 | 1 |
| 6/4/2020 | 9/3/2020 | 1 |
| 6/4/2020 | 30/3/2020 | 2 |
| 13/4/2020 | 3/2/2020 | 1 |
| 13/4/2020 | 9/3/2020 | 1 |
| 13/4/2020 | 30/3/2020 | 1 |
| 13/4/2020 | 6/4/2020 | 2 |
| 20/4/2020 | 3/2/2020 | 1 |
| 20/4/2020 | 9/3/2020 | 1 |
| 20/4/2020 | 30/3/2020 | 3 |
| 20/4/2020 | 13/4/2020 | 1 |
| 20/4/2020 | 20/4/2020 | 2 |
| 27/4/2020 | 9/3/2020 | 1 |
| 27/4/2020 | 30/3/2020 | 1 |
| 27/4/2020 | 27/4/2020 | 9 |
I copy a table with the sample data. I hope you can help me. 🙂
- mahoneypat6 years agoMicrosoft Employee
Thanks for providing data. This turned out to be trickier than I expected. The reason it didn't work before was that the slicer on Report Week was acting on the visual (x-axis) even though we were using All() to remove it for the measures. To get around this, I added a DAX table called ReportDates = VALUES(tb_service_snapshot[week_report]) and made a slicer from that column. I then made two new measures using the TREATAS() function to pass the filter from that new slicer to the measures. One measure calculates for the selected report week and the other for the previous.
This Report Week = var selectedreportweek = values(ReportDates[week_report])var result = CALCULATE([sum measure], TREATAS(selectedreportweek, tb_service_snapshot[week_report]))return if(result =0, BLANK(), result)Last Report Week = var selectedreportweek = DATEADD(values(ReportDates[week_report]),-7,DAY)var result = CALCULATE([sum measure], TREATAS(selectedreportweek, tb_service_snapshot[week_report]))return if(result =0, BLANK(), result)Please let me know if you want the pbix file.
If this is it, please mark as complete. Kudos also appreciated.
Regards,
Pat