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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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))

Share with Power BI Enthusiasts: 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.