Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

YTD

Hi All,    I'm trying to calculate YTD and make the values stop at EOMONTH (Today()) by default.= (i.e. without the month slicer being selected, it should show you YTD up till end of this month).  ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Anonymous Try this:

    var YTD_Sales=CALCULATE(SUM(Sales[Amount]),DATESYTD(DimDate[Date]))

    var YTD_Sales_Today=CALCULATE(SUM(Sales[Amount]),DATESBETWEEN(DimDate[Date],DATE(YEAR(TODAY()),1,1),EOMONTH(TODAY())))

    return IF(MAX(DimDate[Date]) <= EOMONTH (TODAY(),0), YTD_Sales,YTD_Sales_Today)