Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Previous value in DAX

Hello,
 
I would like to use two sets of values for one timestamp, i.e. [Date].
Thus, all values before today, including today, have to be equal to value3. All values after today have to be equal to MIN(value1, value2) + previous day's value. Thus, tomorrow's value = today's value + MIN(value1, value2) or something like that:
 
IF(([Date]) > Today(),
    PrevValue + MIN(value1, value2),
    value3
)

Could you please help with introducing the Previous Value into the calculation.

4 Replies

  • hi Anonymous 

    try like:

    VAR PrevValue =
    MAXX(
       FILTER(
          TableName,
          TableName[Date]=EARLIER(TableName[Date])-1
        ),
       TableName[Value]
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      FreemanZ when you use TableName[Value], what value is it?

      • FreemanZ's avatar
        FreemanZ
        Super User

        hi Anonymous 

        i was assuming you have a tablename[value] column