Forum Discussion
Create table by last 4 weeks
Hi
I want to create a report that always shows the last 4 weeks data, grouped by that week.
I have been trying to use a matrix table but I don't want the rows to group together. I would like a table like below as my result set. The sales stats come from a different data source than the days worked stats so I would be combining two or more queries.
| 2/12/2023 | 2/19/2023 | 2/26/2023 | 3/5/2023 | |
| Required Sales | 500 | 655 | 723 | 800 |
| Total sales | 120 | 555 | 700 | 121 |
| Sales Performance | 24% | 85% | 97% | 15% |
| Days Worked | 45 | 46 | 55 | 47 |
I can set a static visual that the dates are within the last 4 weeks so that next week the dates will change.
Any help and guidance much appreciated
- Anonymous3 years ago
Hi Anonymous ,
I think [Week] column in matrix column field should from a DimWeek table. I suggest you to try to create a measure to filter your visual.
Filter = VAR _THISWEEK = TODAY () - WEEKDAY ( TODAY () ) + 1 VAR _Last4week = _THISWEEK - 28 RETURN IF ( MAX ( DimWeek[Date] ) >= _Last4week && MAX ( DimWeek[Date] ) < _THISWEEK, 1, 0 )Add this measure into visual level filter and set it to show items when value = 1. Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi Anonymous ,
I think [Week] column in matrix column field should from a DimWeek table. I suggest you to try to create a measure to filter your visual.
Filter = VAR _THISWEEK = TODAY () - WEEKDAY ( TODAY () ) + 1 VAR _Last4week = _THISWEEK - 28 RETURN IF ( MAX ( DimWeek[Date] ) >= _Last4week && MAX ( DimWeek[Date] ) < _THISWEEK, 1, 0 )Add this measure into visual level filter and set it to show items when value = 1. Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.