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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Dynamic Dates Between

Hello PowerBi Community, 

 

I'm building a report where I need a type of dynamic DATESBETWEEN,

The report is built from two different sources : 1 and 2, I'm looking for a way to compare data from source 1 at a specific date with data from source 2 at the same date (without creating a date table if possible),

 

This is an accounting report, so dates are related to the fiscal year : starting 1st July each year, and to a closing date (every month);

 

So the dates I would be needing would be : starting date 1st July of the current fiscal year, ending date last day of previous month

 

This is the calculate I came up with for now, but it doesn't seem to be working well for the ending date, and I wasn't able to make a dynamic formula for the starting date either :

JadeC_0-1648625514866.png

What would be the best way to make a dynamic datesbetween ?

 

Thank you very much,

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , why don't you use datesytd

 

example

 

YTD QTY forced=
var _max = eomonth(today(),-1)
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date], "6/30")), blank())
//or
//calculate(Sum('order'[Qty]),DATESYTD('Date'[Date], "6/30"),filter('Date','Date'[Date]<=_max))
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date], "6/30"),filter('Date','Date'[Date]<=_max))

 

 

comments show alternate option. year end at 6/30

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

@Anonymous , why don't you use datesytd

 

example

 

YTD QTY forced=
var _max = eomonth(today(),-1)
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESYTD('Date'[Date], "6/30")), blank())
//or
//calculate(Sum('order'[Qty]),DATESYTD('Date'[Date], "6/30"),filter('Date','Date'[Date]<=_max))
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date], "6/30"),filter('Date','Date'[Date]<=_max))

 

 

comments show alternate option. year end at 6/30

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

Thank you very much ! It worked !

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.

Top Solution Authors