cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
benparody
Frequent Visitor

Rolling average

Hi 
 
Can anyone see whats wrong with this formula? id like to get a 30 day rolling average, but i saw this online and tried to use it, just to get any kind of rolling average for now. but the result i get from this is the same number as teh Turnoer number, not an average at all.
 
Any ideas?
 
Turnover 30D Avg. = CALCULATE(
AVERAGEX(
FILTER(ALLSELECTED('Calendar'),
'Calendar'[Date] <= MAX('Calendar'[Date])),
onetouch_daily_account_summary_last_2_months[Turnover (€)])

)
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

If Turnover is a column rather than a measure, I think you should put the CALCULATE inside the AVERAGEX iterator in order to do the context transition.

 

Turnover 30D Avg. =
AVERAGEX (
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    ),
    CALCULATE ( onetouch_daily_account_summary_last_2_months[Turnover (€)] )
)

 

View solution in original post

3 REPLIES 3
benparody
Frequent Visitor

@AlexisOlson - just a follow up question if i may, how can i make this formula (which works fine) to be a 30 day average. at the moment its pulling the default total from the data set so id like to restrict this to Last 30 days only please.

benparody
Frequent Visitor

@AlexisOlson  thank you for the reply, it works great now. much appreciated!

AlexisOlson
Super User
Super User

If Turnover is a column rather than a measure, I think you should put the CALCULATE inside the AVERAGEX iterator in order to do the context transition.

 

Turnover 30D Avg. =
AVERAGEX (
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    ),
    CALCULATE ( onetouch_daily_account_summary_last_2_months[Turnover (€)] )
)

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors