Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Tableau WINDOW_AVG function in Power BI

Hi All,

 

I am trying to rebuild a series of dashboards from Tableau to PowerBI.

 

One of the calculations I have come across is:
WINDOW_AVG(COUNT([Event Description])/AVG([Turbines]), -2, 0)

 

The turbines portion of this is the name of the actual turbine so I will need to make a measure that is T_Count = Count('Faults'[Turbines]) and then count the event descriptions. But I can't figure out the equivalent of the WINDOW_AVG function or how to find the average of the count turbines measure.

 

Thanks in advance,

 

Mike

2 Replies

  • Hi Anonymous -calculate the moving average over the last 3 periods (including the current period) as below:

     

    Moving_Avg_Event_Count =
    AVERAGEX(
    FILTER(
    ALLSELECTED('Faults'),
    'Faults'[Date] >= MAX('Faults'[Date]) - 2 &&
    'Faults'[Date] <= MAX('Faults'[Date])
    ),
    CALCULATE(COUNT('Faults'[Event Description]) / COUNT('Faults'[Turbines]))
    )

     

    Hope it works

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

  • Hi,

    Share some data to work with, explain the question and show the expected result.  Share data in a format that can be pasted in an MS Excel file.