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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
SLHVS_8
New Member

DAX Formular for a defined period (date x - until today)

Hi All, 

 

I am currently trying to figure out a formular for a given time period e.g. Jan 3rd - today. Important is that it will update automatically, meaning today will always be the actual today date. 

The chosen period will then affect the table, but there are no dates included). 

I am currently working with the dates as a slicer and the format between to have a timeline, but this is not automatically updating. 

 

It would be great, if someone could help 🙂

Thanks a lot in advance 

 

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @SLHVS_8 ,

 

Please create the Dates table.

 

Dates = CALENDAR ( DATE ( 2022, 1, 1 ), TODAY () )

 

 Then create the "After" type slicer.

 

vkkfmsft_0-1651568280591.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@SLHVS_8 , if you need Cumulative

 

Switch Period =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = Minx(ALLSELECTED('Date'),'Date'[Date])
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

 

MTD

MTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

 

 

fin YTD

 

This FYTD=
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min =if( Month(_max) <4 , date(year(_max)-1,4,1) ,date(year(_max),4,1)), //FY April -March
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

 

 

YTD=
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min =eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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