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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
sarhutson
Frequent Visitor

How to get a MIN, MAX, and Median on a rolling average measure?

I have a measure that calculates 'Chargeback % Incurred' by month. I created a new measure called 'Rolling 3 Mo Avg' it looks at current month and the past 2 and returns an average accross the 3. This is where im getting stumped... I need to take the rolling 3 month minimum of the already rolling 3 month average. I'm not sure how to do a rolling minimum or max on a rolling average. 

My example:

sarhutson_0-1677709506584.png

The MIN of the rolling 3 average - the 1.05% is the minimum of the past 3 months rolling 3 month average (2.21, 1.65, 1.05) the same the with the MAX column. 

Chargeback % Incurred measure: 

sum('Analysis Table'[Total Chargebacks]) / sum('Analysis Table'[Total Fundings])

Rolling 3 Mo Avg = IF(
    SELECTEDVALUE('Date Table'[MonthInCalendar]) in ALLSELECTED('Date Table'[MonthInCalendar]),
    CALCULATE(
        DIVIDE (-SUM('Analysis Table'[Total Chargebacks]), SUM('Analysis Table'[Total Fundings])),
        DATESINPERIOD(
            'Date Table'[Date],    LASTDATE('Date Table'[Date]),      -3,MONTH )))
     

 

2 REPLIES 2
amitchandak
Super User
Super User

@sarhutson , Try if this can help

 

sample measure 

 

Max 3 Month Avg = Maxx(Values('Date'[MONTH Year]), CALCULATE(AverageX(Values('Date'[MONTH Year]),calculate(Sum('Table'[Value)))
,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH)) ,DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-3,MONTH))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hey @amitchandak Im not sure if I did this correctly but I'm not seeing the results I would expect. 

Max 3 Month Avg = Maxx(Values('Date Table'[MonthInCalendar]), CALCULATE(AverageX(Values('Date Table'[MonthInCalendar]),calculate([Chargeback %]))
,DATESINPERIOD('Date Table'[Date],MAX('Date Table'[Date]),-3,MONTH) ,DATESINPERIOD('Date Table'[Date],MAX('Date Table'[Date]),-3,MONTH)))
sarhutson_0-1677770340960.png

I would expect 2.21% for Jan 2023

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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