Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
If [EndDate] is equal to any of these dates (2/9/2019, 2/16/2019, 2/23/2019) then I want
[FinalDifference] = [PreDifference] – 1
EndDate | PreDifference | FinalDifference |
2/1/2019 | 1 | 1 |
2/9/2019 | 1 | 0 |
2/16/2019 | 1 | 0 |
2/17/2019 | 1 | 1 |
2/23/2019 | 1 | 0 |
Unfortunately I am putting 2/23/2019 into [FinalDifference] instead, can you help?
[FindDate]:
LOAD Concat(Chr(39) & [SubtractDate] & Chr(39), ',') as DateTable
;
LOAD *
INLINE [
SubtractDate,
2/9/2019,
2/16/2019,
2/23/2019,
]
;
Let vDateTable = Peek('DateTable');
DROP DateTable [FindDate];
[Summary]:
EndDate,
PreDifference,
IF([EndDate] = $(vDateTable),[PreDifference]-1) AS [FinalDifference]
RESIDENT [PreSummary];