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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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

@amitchandak thanks! worked like charm!

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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