08-25-2020 12:58 AM
Hi All,
For the below example, how to calculate the Column C in a CDS View?
C1 = A1-B1
C2 = C1-B2
C3=C2-B3 and so on..
Thanks in Advance!
08-30-2020 12:47 PM
Hello reachglady
Do you have any record ID in the table? Or a date by which you can sort the records? If yes, then have a look at this example:
SELECT a, b, (a - ISNULL((
SELECT TOP 1 b
FROM table AS t2
WHERE t2.id < t1.id
ORDER BY id DESC), 0) AS c
FROM table AS t1
Hope this helps you out.
Kind regards,
Mateusz