Forum Discussion
Ale
Resolver II
4 years agoYTD value as Calculated Column (not measure) in Data View
I'm trying to create 2 columns with the Year to Date values for each record in my table, but keeping all other descriptive data (Category, Product, etc) into account. I attached a table with the ...
- 4 years ago
Hi, Ale ;
Try to create a column by dax.
YTD = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Category]=EARLIER('Table'[Category])&&[Product]=EARLIER('Table'[Product])), DATESYTD('Table'[Date]))YTD-M1 = CALCULATE(MAX('Table'[YTD]),FILTER('Table',[Category]=EARLIER('Table'[Category])&&[Product]=EARLIER('Table'[Product])&&EOMONTH([Date],0)=EOMONTH(EARLIER('Table'[Date]),-1)))+0The final show;
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
4 years agoAle , Try like
YTD =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
YTD +1 =
var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _min = eomonth(_max,-1*MONTH(_max))+2
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Ale
Resolver II
4 years ago