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
blestone111
Regular Visitor

DAX measure wot work out YTD 01 April 2023 to end of the most recent Sunday

Hi Experts

 

I have a Date Table with all the correct columns including Week Start and Week End Date and Week Rank in my date Table. I am trying to work YTD from 1 April 2023 to the last sunday which is 25th Feb 24 then next week the calculcation becomes 01 April 2023 to last sunday current year (03 rd march 24) and so on...

 

PS cannot upload a file due to data - Sorry

1 REPLY 1
amitchandak
Super User
Super User

@blestone111 , Try a measure like

 

FYTD =
var _max1 = if(isfiltered('Date'),MAXx( allselected('Date'), 'Date'[Date]) , today())
var _min = if( Month(_max1) <4 , date(year(_max1)-1,4,1) ,date(year(_max1),4,1)), //FY April -March
var _max = _max1 -WeekDay(_max1) +1 //Last sunday
return
CALCULATE([Your Measure] ,Filter(('Date'[Date]),'Date'[Date]>= _min && 'Date'[Date] <= _max))

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.