Forum Discussion
PowerUser2000
Helper I
1 year agoCreating moving average across all dates selected vs not selected?
This is what I have so far: Percent Total direct deposit accounts v3 = IF( ISFILTERED(Dates[Date]), // Check if any date filter is applied // If dates ARE filtered, average only the ...
- 1 year ago
Percent Total Direct Deposit Accounts v4 = VAR IsDateFiltered = ISFILTERED(Dates[Date]) RETURN IF( IsDateFiltered, AVERAGEX( VALUES(Dates[Date]), DIVIDE( [RollingAverageDirectDepositCount33Days], [RollingAverageCheckingAccountsCount33Days] ) ), CALCULATE( AVERAGEX( ALL(Dates[Date]), DIVIDE( [RollingAverageDirectDepositCount33Days], [RollingAverageCheckingAccountsCount33Days] ) ), ALLSELECTED(Dates) // Keeps other slicers like region, branch, etc. ) )- DIVIDE() is better than / to avoid divide-by-zero errors.
- ALLSELECTED(Dates) ensures that other slicers are respected even when no date is selected.
- ALL(Dates[Date]) ensures the full date range is used when no date filter is applied.
Please give a thumbs up if this helps
v-hashadapu
Community Support
1 year agoHi PowerUser2000 , Thank you for reaching out to the Microsoft Community Forum.
I took some sample data and reproduced your scenario.
For your reference, I’ve attached the working .pbix file, please check it and share your thoughts.
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.