Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Checco
Contributor
Contributor

Set analysis. Qlikview Difference between date columns

I ask you how I can go about solving this problem
I have to build a pivot table made up of many columns each containing the difference between the sum of the sales at the maximum date and the sum in the previous date, the difference between the sum in the previous date and the sum at the even earlier date and so on
For example the input is like the table below and output is the next one.

Input:

ID        DATE             SALES
1          30-08-22         120
1          30-08-22         124
2          22-08-22         131
2          22-08-22         139
3          17-08-22         121
3          17-08-22         118
4          11-08-22         115
4          11-08-22         109
5          02-08-22         108
5          02-08-22         118

 

output

MAX           PREC           DIFFERENCE
244              270              -26
170              239              -69
239              224              15
224              226              -2
226              ---                ---

Labels (1)
2 Replies
sidhiq91
Specialist II
Specialist II

@Checco  Could you please elaborate on the expected output? I am not able to understand your exact requirement.

Checco
Contributor
Contributor
Author

Ok.

In the first column I have the sum of the values ​​fields (120 + 124) relating to the maximum value of the date (30-08-22).
In the second column I have the sum of the values ​​of the fields (131 + 139) relating to the second value of the date (22-08-22).
Between the two previously calculated values, I make the difference.

Second line.
Similarly to above and as given I consider the second (22-08-22) and the third (17-08-22).

Third row.
Always as above and as you consider the third (17-08-22) and the fourth (14-08-22).

So below each row for all other date values.

 

Thank 1000