Forum Discussion
Calculated Column - Every day, based on Previous Day Value
- 4 years ago
Hi, DataUser
Your problem can be solved by a few calculated columns.
Date2 = [Date]-1N1 = [Fixed Initial Value]+[A]-[B]N2 = IF ( CALCULATE ( SUM ( 'Table'[N1] ), FILTER ( 'Table', [Date] <= EARLIER ( 'Table'[Date] ) ) ) >= 300, 300, CALCULATE ( SUM ( 'Table'[N1] ), FILTER ( 'Table', [Date] <= EARLIER ( 'Table'[Date] ) ) ) )C = IF ( CALCULATE ( MAX ( 'Table'[N2] ), FILTER ( 'Table', [Date] = EARLIER ( 'Table'[Date2] ) ) ) >= 300, 300 + [A] - [B], [N2] )Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi DataUser
The function LOOKUPVALUE DAX (https://docs.microsoft.com/fr-fr/dax/lookupvalue-function-dax) can help you I think to get the data from the previous days & use it in your measure.
VAR Value_A_from_previous_date =
LOOKUPVALUE([column A], [column date], [column date]-1)
VAR Value_B_from_previous_date =
LOOKUPVALUE([column B], [column date], [column date]-1)
RETURN
MIN(Value_A_from_previous_date - Value_B_from_previous_date + [column A] - [column B], 300)
Please accept it as a solution if it solved your issue.
Have a nice evening