Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi
Is there a way to have a bar graph shows the past 2, 4 or 8 rolling week based on the slicer date value selected by the user.
Rgds Henrik
Solved! Go to Solution.
Hi @Henrik_99 ,
You can refer the following links to get it:
Calculate Dynamic Rolling 4 Week Average based on multi-level category filters and using only week #
Rolling Dynamic Weeks =
VAR _selnumber =
SELECTEDVALUE ( 'Numbers'[No movement in (weeks)] )
VAR _table =
CALCULATETABLE (
VALUES ( 'Table'[Week] ),
FILTER (
ALLSELECTED ( 'Table'[Week] ),
'Table'[Week]
>= MAX ( 'Table'[Week] ) - _selnumber - 1
&& 'Table'[Week] <= MAX ( 'Table'[Week] )
)
)
RETURN
IF (
COUNTAX ( _table, [Week] ) = _selnumber,
SUMX ( _table, CALCULATE ( SUM ( 'Table'[value] ) ) )
)
Calculate Relative Weeks in Power BI
If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi @Henrik_99 ,
You can refer the following links to get it:
Calculate Dynamic Rolling 4 Week Average based on multi-level category filters and using only week #
Rolling Dynamic Weeks =
VAR _selnumber =
SELECTEDVALUE ( 'Numbers'[No movement in (weeks)] )
VAR _table =
CALCULATETABLE (
VALUES ( 'Table'[Week] ),
FILTER (
ALLSELECTED ( 'Table'[Week] ),
'Table'[Week]
>= MAX ( 'Table'[Week] ) - _selnumber - 1
&& 'Table'[Week] <= MAX ( 'Table'[Week] )
)
)
RETURN
IF (
COUNTAX ( _table, [Week] ) = _selnumber,
SUMX ( _table, CALCULATE ( SUM ( 'Table'[value] ) ) )
)
Calculate Relative Weeks in Power BI
If the above one can't help you get the desired result, please provide more sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Without being given more information, it's hard to say. I can suggest changing the slicer selection settings to "Single Value", and then use the SELECTEDVALUE(No movement in Weeks) to get your users' selected value. You can use that in your calculations for the bar graph values.
Vicky,
it`s simple table, see table with dimdate table:
thanks
Henrik
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |