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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Dax to return date range for Fiscal YTD based on today

I have a calendar table with fields Date, Year(Calendar), and Year(Fiscal). I need a measure that will return the date range logic as follows, but I can't figure out the proper syntax:

 

Dates between:  

   Min(Calendar[Date] where Year(Fiscal) = same Year(Fiscal) as today)    and

   Calendar[Date] = today()

 

So if the start of current FY = 4/1/21, the date range it would return is 4/1/2021 - 5/6/2021. Thoughts for as compact of dax as possible?

4 REPLIES 4
sayaliredij
Super User
Super User

Hi @Anonymous 

 

Sorry I missed fiscal year thingy

 

Could you try following formula

 

DatesYTD-Fiscal = 
var cur = Today()
VAR StartDate = DATE ( Year(cur), 4, 1 )
VAR EndDate = cur
RETURN
DATESBETWEEN ( 'Date'[Date], StartDate, EndDate )
ORDER BY [Date]

 

Regards,

Sayali





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

Proud to be a Super User!




Anonymous
Not applicable

I am unable to run because I can't get syntax right for how it fits into a measure, but just looking at it seems like it's not going to be right because it's looking at the year of today. So, theoretically it works when we're in the months where Calendar and Fiscal year numbers are the same, but January of next year is not going to work.

sayaliredij
Super User
Super User

Hi 

 

You can use the following DAX Formule. It will return the table with dates you are looking for

DatesYTD = 

CALCULATETABLE (
DATESYTD ( 'Date'[Date] ),
'Date'[Date] = TODAY ()
)

 Regards,

Sayali

 

If this post helps, then please consider Accept it as the solution to help others find it more quickly





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

Proud to be a Super User!




Anonymous
Not applicable

How does that fit in to checking that the date is based on the current Fiscal year?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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