Forum Discussion
DAX formula
I am migrating Tableau reports to Power BI. In Tableau report there is a formula "WINDOW_AVG(SUM([Hours]), -6, 0)". I am not able to create same formula in Power BI. Can anyone suggest? This formula gives 7 days average of hours for each date.
Hi,
You could try a calculated column with something like this:
7 Day Average = CALCULATE( AVERAGE([Hours]), FILTER( ALL('YourTable'), 'YourTable'[Date] >= EARLIER('YourTable'[Date]) - 6 && 'YourTable'[Date] <= EARLIER('YourTable'[Date]) ) )
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
3 Replies
- DOLEARY85Resident Rockstar
Hi,
You could try a calculated column with something like this:
7 Day Average = CALCULATE( AVERAGE([Hours]), FILTER( ALL('YourTable'), 'YourTable'[Date] >= EARLIER('YourTable'[Date]) - 6 && 'YourTable'[Date] <= EARLIER('YourTable'[Date]) ) )
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
- XYZ56New Member
Hi
For me this below error is coming
A circular dependency was detected: Export Worksheet[7 Day Average].
Could anyone please help
- YashiNew Member
Thanks, it's working.