Forum Discussion

Yashi's avatar
Yashi
New Member
2 years ago
Solved

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

  • DOLEARY85's avatar
    DOLEARY85
    Resident 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 👍

    • XYZ56's avatar
      XYZ56
      New Member

      Hi
      For me this below error is coming
      A circular dependency was detected: Export Worksheet[7 Day Average].
      Could anyone please help