Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Masikonde
Frequent Visitor

Trailing Average

Hi all,

 

I have been trying to move all reports calculations from excel spreadsheets, and completely using Power BI. I'm having an issue calculating trailing 12 months trailing average in Power BI, I can calculate the trailing average in excel, but the researches I'm doing in power BI is leading me to rolling average. Currently I import the calculations from excel. As shown in the diagram below, I want to calculate rolling average and trailing average, I need help calculating the "Trailing Average". 

Trailing Average.PNGData source.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Masikonde ,

I'd like to suggest you do unpivot columns on your table, then you can write a measure formula to loop all fields for rolling calculations based on its attribute.

Unpivot columns (Power Query)

Measure =
VAR currDate =
    MAX ( Table[Date] )
RETURN
    CALCULATE (
        AVERAGE ( Table[Value] ),
        FILTER ( ALLSELECTED ( Table ), [Date] <= currDate ),
        VALUES ( Table[Attribute] )
    )

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Masikonde ,

I'd like to suggest you do unpivot columns on your table, then you can write a measure formula to loop all fields for rolling calculations based on its attribute.

Unpivot columns (Power Query)

Measure =
VAR currDate =
    MAX ( Table[Date] )
RETURN
    CALCULATE (
        AVERAGE ( Table[Value] ),
        FILTER ( ALLSELECTED ( Table ), [Date] <= currDate ),
        VALUES ( Table[Attribute] )
    )

Regards,

Xiaoxin Sheng

The process worked on Excel, but could not work on power BI. I think because I'm trying to look for average from defferent departments.

Anonymous
Not applicable

Hi @Masikonde ,

You need to go to 'query editor' to do 'unpivot column' feature on your table fields, then save change and return to the 'data view' side to write sample formula.

If you still confused about how to use it, please share a pbix file with some sample data for test and coding formula.
Regards,

Xiaoxin Sheng

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors