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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.