Forum Discussion
YTD to current date
Good Morning
I have the following measure for year to date, my year needs to end on the 31st October.
When i add the measure to a line graph it shows up to the end of 31st October 23, i only want to see up to today.
1 Reply
- amitchandak
Super User
Anonymous , First of all use date table , date of your table should join with date table
YTD =
calculate(
[TotalOrders],
datesytd( 'Date'[Date],
"10/31"
), 'Date'[Date] <= today())or
YTD =
var _omax = format(if(isfiltered('Date'),MAXX( allselected( 'Date') , 'Date'[Date]) , today()), "MMDD")
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = if(month(_max) <10, Date(year(_max)-1,10,1) ,Date(year(_max),10,1) )
return
CALCULATE(calculate([net], filter('Date'), format('Date'[Date], "MMDDD") <=_omax) ,DATESBETWEEN('Date'[Date],_min,_max))