Forum Discussion

TheHans's avatar
TheHans
Helper I
5 years ago
Solved

Get previous date values

Hi Guys, I have a table that contains a report date and  values for that date. The dates are unique in the table. In the visual I would like to highlight the differences of Amount 1 (Report date-Pr...
  • stevedep's avatar
    5 years ago

    Hi,

    pls see below:

    PrevAmount = 
    VAR _selDate = SELECTEDVALUE(DimDate[Date])
    VAR _maxDate = CALCULATE(LASTNONBLANK(DimDate[Date], CALCULATE(SUM('Table'[Amount1]))), FILTER(ALLSELECTED(DimDate), [Date] < _selDate))
    RETURN
    IF(NOT(ISBLANK(SUM('Table'[Amount1]))),
    CALCULATE(SUM('Table'[Amount1]), FILTER(ALLSELECTED(DimDate),DimDate[Date] = _maxDate)), BLANK())

    Kind regards, Steve.