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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RamblingFire
Regular Visitor

Moving average across columns

Hi, 

 

I have data like:

Name, 2024-01, 2024-02, 2024-03, etc to 2025-01

Customer a, 5,5,10,10 etc

Customer b, 10,11,11,12 etc

Customer c, 0,0,0,0....7,7 as they only have values for last 2 months

 

I'd like a column added that gives moving average over as many months as there is data to indicate a trend

 

Is that possible? 

1 ACCEPTED SOLUTION
Irwan
Super User
Super User

hello @RamblingFire 

 

i might be misunderstood but please check if this accomodate your need.

 

1. i assumed your table looks like this based on your description above.

Irwan_1-1740439628162.png

2. unpivot the table and rename the header if needed.

Irwan_2-1740439654373.png

3. create a new measure with following DAX

Average =
var _Name = SELECTEDVALUE('Table'[Name])
Return
AVERAGEX(
    FILTER(
        ALL('Table'),
        'Table'[Name]=_Name&&
        'Table'[Date]<=MAX('Table'[Date])
    ),
    'Table'[Value]
)
4. plot into table visual
Irwan_0-1740439592091.png
 
Hope this will help.
Thank you.

View solution in original post

1 REPLY 1
Irwan
Super User
Super User

hello @RamblingFire 

 

i might be misunderstood but please check if this accomodate your need.

 

1. i assumed your table looks like this based on your description above.

Irwan_1-1740439628162.png

2. unpivot the table and rename the header if needed.

Irwan_2-1740439654373.png

3. create a new measure with following DAX

Average =
var _Name = SELECTEDVALUE('Table'[Name])
Return
AVERAGEX(
    FILTER(
        ALL('Table'),
        'Table'[Name]=_Name&&
        'Table'[Date]<=MAX('Table'[Date])
    ),
    'Table'[Value]
)
4. plot into table visual
Irwan_0-1740439592091.png
 
Hope this will help.
Thank you.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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