Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hallo,
I have used following function to get difference between two months but unable to get result in Qlikview.
If(month = 'jan',0, data - Pick (data, -1)) as Difference
Can anybody help me with it.
Best regard
Kazi
Month | Sales | Difference |
Jan | 1000 | 0 |
Feb | 1200 | 200 |
Mar | 1250 | |
Apr | 1500 |
one example using a chart expression rather than generating the Difference field in the script:
hope this helps
regards
Marco
Are you looking for this?
IF yes you can try like below:
SalesDiff:
LOAD *, IF(Month = 'Jan', 0, Sales - Previous(Sales)) AS Diff INLINE [
Month, Sales
Jan, 1000
Feb, 1200
Mar, 1250
Apr, 1500
];
Then use straight table and add
Dim: Month, Sales
Expr: Diff
Then uncheck suppress 0 values in Presentation tab.
Hallo Vishwarath Nagaraju, thank you for your reply. if there is any change in sales value, do i always have to change the sales value in schript ? is it possible to do smothing in expressions ?
Hallo Marco Wedel,
i am talking about pick . i am looking for solution. if the result came from another function i have no problem to use that.
I don't find any reason that you have to change your sales. Am i missing something? Please elaborate the issue. Do the script solution not work for you?
Hi,
one possible solution using Peek instead of Pick might be:
table1:
LOAD Month(Date#(Month,'MMM')) as Month,
Sales,
Alt(Sales-Peek(Sales),0) as Difference
FROM [https://community.qlik.com/thread/301877] (html, codepage is 1252, embedded labels, table is @1);
hope this helps
regards
Marco
one example using a chart expression rather than generating the Difference field in the script:
hope this helps
regards
Marco