Forum Discussion

Ale's avatar
Ale
Icon for Resolver II rankResolver II
4 years ago
Solved

YTD 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 ...
  • v-yalanwu-msft's avatar
    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)))+0

    The 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.