Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Need to subtract the current value from previous value in Set Analysis
below is Actual value & expected output against the quarters
Quarter | Value | Expected Output |
Q1 | 30 | 30 |
Q2 | 90 | 60 |
Q3 | 120 | 30 |
Q4 | 180 | 60 |
Regards,
Ali
Hi @alis2063,
You don't need Set Analysis. You can do this changing your Load Script. See the code below:
TempData: LOAD * INLINE [ Quarter,Value Q1,30 Q2,90 Q3,120 Q4,180 ]; Data: LOAD Quarter, Value, Value - Alt(Peek(Value),0) AS Expected RESIDENT TempData ORDER BY Quarter ; DROP TABLE TempData;
Hi @alis2063,
You don't need Set Analysis. You can do this changing your Load Script. See the code below:
TempData: LOAD * INLINE [ Quarter,Value Q1,30 Q2,90 Q3,120 Q4,180 ]; Data: LOAD Quarter, Value, Value - Alt(Peek(Value),0) AS Expected RESIDENT TempData ORDER BY Quarter ; DROP TABLE TempData;
Can't we do this in set analysis
hi @alis2063,
Maybe it is possible to do using Set Analysis, but Qlik have other features to better handle this scenario.
For a chart table for example you can use the Above function:
Sum(Value) - Alt(Above(Sum(Value)),0)
Where are you trying to use that expression?
I have tried the same set analysis unfortunately not working for me