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
giorgiokatr
Helper V
Helper V

max of rolling average per day

i have a table with rows per day and the rolling average of every day (minus 3days)

 

rollingAvg =
VAR NumOfMonths = 3
VAR LastCurrentDate =MAX ( 'Table'[date])
VAR Period =DATESINPERIOD ( 'Table'[date], LastCurrentDate, - NumOfMonths, DAY )
VAR Result = CALCULATE (  AVERAGEX ( VALUES ( 'Table'[date] ), AVERAGE('Table'[value])), Period )

RETURN
   Result
 
i would like to have the max of those values for the last 20 days (the max of everyday rolling average) 
i used 
Measure = MAXX('Table',[rollingAvg])
but it gives me wrong results
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@giorgiokatr , Try like

 

calculate(MAXX(values('Table'[Date]),[rollingAvg]), DATESINPERIOD ( 'Table'[date], MAX ( 'Table'[date]), - -20, DAY ))

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@giorgiokatr , Try like

 

calculate(MAXX(values('Table'[Date]),[rollingAvg]), DATESINPERIOD ( 'Table'[date], MAX ( 'Table'[date]), - -20, DAY ))

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

@amitchandak thanks! worked like charm!

 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.