Forum Discussion

MeadowDec's avatar
MeadowDec
Frequent Visitor
2 years ago
Solved

YTD calulation in reverse

Hi, I need to make a measure that works out the 'complete' YTD value for the current financial year April to March, and then deducts the YTD value for the current month from that.   I was using DA...
  • MeadowDec's avatar
    MeadowDec
    2 years ago

    The answer was I had to hard code in the day & month start & end dates while pulling the filter context relevant year from attributes living in the date dimension and build into a date function as Dangar332 demonstrated in his answer above.

     

    YTG =
    VAR MaxFinDate = max('Date'[FinancialYearEnd])
    VAR MinFinDate = min('Date'[FinancialYearStart])
    VAR FullYTD = CALCULATE([ActualRevenue],'Date'[Date] <= date(MaxFinDate,3,31) && 'Date'[Date] >= date(MinFinDate,4,1))
    VAR Result = FullYTD - [ActualReleasedRevenue_YTD]
    RETURN Result