Forum Discussion
Stacked bar chart with rolling four weeks
- 5 years ago
UPDATE: For now I added a new column that is
Show On Visual = if(WEEKNUM('dataset'[Work Date])>WEEKNUM(Today())-4,1,0)
Then I add this filter to the visual where the value is 1 and it works.
- 5 years ago
Hi guyinazo ,
What result do you want to return for the measure you created. If you want to get the rolling value within four weeks, you can refer to the following formula.
M = VAR endweek = WEEKNUM ( TODAY () ) VAR startweek = endweek - 4 RETURN CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table' ), WEEKNUM ( TODAY () ) >= startweek && WEEKNUM ( TODAY () ) <= endweek ) )
If the problem is still not resolved, no further test can be done just by looking at the formula. Hope to provide a test data model (delete sensitive information) and detailed expected results.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
UPDATE: For now I added a new column that is
Show On Visual = if(WEEKNUM('dataset'[Work Date])>WEEKNUM(Today())-4,1,0)
Then I add this filter to the visual where the value is 1 and it works.