Forum Discussion

AU555's avatar
AU555
Helper I
6 years ago
Solved

Substracting values in same columns based on date column

Hi everybody, I hope I could get a little help here. I need a help to create following calculated column and that is "compared" in my sample table. We generate new dates for actual and planned f...
  • Anonymous's avatar
    Anonymous
    6 years ago

    AU555 

    Column =
    VAR PrevDate = CALCULATE(MAX(Test[ReportingDate]),FILTER(ALL(Test[ReportingDate]),Test[ReportingDate]<MAX(Test[ReportingDate])),ALLEXCEPT(Test,Test[Product]))
    VAR PrevValue = CALCULATE(SUM(Test[PrevDateDiff]),Test[ReportingDate]=PrevDate,ALLEXCEPT(Test,Test[Product]))
    RETURN CALCULATE(SUM(Test[DateDiff])-PrevValue,ALLEXCEPT(Test,Test[Product]))