Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vkng
Frequent Visitor

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 4
FreemanZ
Super User
Super User

hi @vkng 

try like:

VAR PrevValue =
MAXX(
   FILTER(
      TableName,
      TableName[Date]=EARLIER(TableName[Date])-1
    ),
   TableName[Value]
)
vkng
Frequent Visitor

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

hi @vkng 

i was assuming you have a tablename[value] column

vkng
Frequent Visitor

@FreemanZ In my case all three values are measures.
So, I would like to use values from value1 (or measure 1) until tommorrow, and then use either value2 or value3 (or measure 2 or measure 3) for future dates. At the same time I would like to connect this two sets values in form of a cumulative total.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors