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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

max value from last 14 days

Hi All,

 

I have below data.

 

for each row i need to look back 14 days and pick which is max value and display it.

pls see data below. 3rd column is the result i am looking for can you please tell me how to get that? i tried different dax but not working.  @MFelix @Kinjal @simrantuli @Pragati11 @mwegener @amitchandak 

 

Value.tradingDayValue.highMax Value
12/14/2018415.75 
12/17/2018417.75 
12/18/2018421.25 
12/19/2018421.25 
12/20/2018418.5 
12/21/2018418.25 
12/24/2018417.75 
12/26/2018416 
12/27/2018416.75 
12/28/2018418 
12/31/2018419.25 
1/2/2019419.5 
1/3/2019421 
1/4/2019422.5422.5
1/7/2019422.75422.75
1/8/2019421.75422.75
1/9/2019421.75422.75
1/10/2019419422.75
1/11/2019423.25423.75
1/14/2019420.5 
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Try with help from a date table

Rolling 14 = CALCULATE(max(Table[Value.high]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-14,Day))

 

or

 

Rolling 14 = if(CALCULATE(distinctcount(Table[Value.tradingDay]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-14,Day)) >=14, CALCULATE(max(Table[Value.high]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-14,Day)) , blank())

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

ryan_mayu
Super User
Super User

@Anonymous 

you can try to create a column

Column = if( 'Table'[Value.tradingDay]-min('Table'[Value.tradingDay])<14,blank(),MAXX(FILTER('Table','Table'[Value.tradingDay]>=EARLIER('Table'[Value.tradingDay])-14 &&'Table'[Value.tradingDay]<=EARLIER('Table'[Value.tradingDay])),'Table'[Value.high]))

1.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@Anonymous 

you can try to create a column

Column = if( 'Table'[Value.tradingDay]-min('Table'[Value.tradingDay])<14,blank(),MAXX(FILTER('Table','Table'[Value.tradingDay]>=EARLIER('Table'[Value.tradingDay])-14 &&'Table'[Value.tradingDay]<=EARLIER('Table'[Value.tradingDay])),'Table'[Value.high]))

1.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

@ryan_mayu Thanks Ryan, it works fine.

amitchandak
Super User
Super User

@Anonymous , Try with help from a date table

Rolling 14 = CALCULATE(max(Table[Value.high]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-14,Day))

 

or

 

Rolling 14 = if(CALCULATE(distinctcount(Table[Value.tradingDay]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-14,Day)) >=14, CALCULATE(max(Table[Value.high]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-14,Day)) , blank())

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
Anonymous
Not applicable

Hi @amitchandak  its not working, shoot.

johnbasha33_0-1610718156303.png

for 5/1/2019 max value of last 14 days is 425 not 422.25

i tried many dax functions it is not coming.

 

pls assist.

Anonymous
Not applicable

@amitchandak  Thanks Amit it works fine.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.