Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlik Community,
I have the below data whereby I have two Backlog Types (CRS and RS) and I would need to add another Backlog Type "Cumulative Delta" where I pre-calculate the cumulative difference between RS and CRS in the load script so that I can do a pivot in Qlik NPrinting. For example I have the below set of data:
PN | MPN | CPN | Customer | Country | Family | OrderID | Fiscal Week | BacklogType | Sum(Qty) |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201912 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201912 | RS | 1000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201913 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201913 | RS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201914 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201914 | RS | 3000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201915 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201915 | RS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201916 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201916 | RS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201917 | CRS | 1000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201917 | RS | 1000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201912 | CRS | 5000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201912 | RS | 5000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201913 | CRS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201913 | RS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201914 | CRS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201914 | RS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201915 | CRS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201915 | RS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201918 | CRS | 5000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201918 | RS | 5000 |
I'd like to pre-calculate Cumulative Delta in the load script. The calculation should be -1*CRS+RS and accumulate by week, ordered by PN, MPN, CPN, Customer, Country, Family and OrderID. But the sum(Qty) of CRS and RS should not be cumulative. I've attached the calculation method of the Cumulative Delta in excel, the desired pivot table output and my current script in Nprinting in the excel file. I'm thinking if I should be using the If(Peek() function with Rangesum, but not sure how exactly to apply.
PN | MPN | CPN | Customer | Country | Family | OrderID | Fiscal Week | BacklogType | Sum(Qty) |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201912 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201912 | RS | 1000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201912 | Cumulative Delta | -1000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201913 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201913 | RS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201913 | Cumulative Delta | -1000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201914 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201914 | RS | 3000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201914 | Cumulative Delta | 0 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201915 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201915 | RS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201915 | Cumulative Delta | 0 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201916 | CRS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201916 | RS | 2000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201916 | Cumulative Delta | 0 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201917 | CRS | 1000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201917 | RS | 1000 |
CP123 | AB2334 | CDF345 | John | MALAYSIA | A | 12345 | 201917 | Cumulative Delta | 0 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201912 | CRS | 5000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201912 | RS | 5000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201912 | Cumulative Delta | 0 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201913 | CRS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201913 | RS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201913 | Cumulative Delta | 0 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201914 | CRS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201914 | RS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201914 | Cumulative Delta | 0 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201915 | CRS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201915 | RS | 7500 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201915 | Cumulative Delta | 0 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201918 | CRS | 5000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201918 | RS | 5000 |
CDS345 | B234 | DBF889 | Karl | GERMANY | B | 98080 | 201918 | Cumulative Delta | 0 |
Dear @sunny_talwar, you can ignore the previous thread about grouping historical data, I'll close it. But do you have any ideas how to solve this one? Thanks!
Anyone else who knows the solution, please help as well!
Thanks in advanced 🙂
Hi,
Check the attached qvf and see how it should be 🙂
Hi Channa,
The script is in the second tab of the attached excel.
Hi @kaanerisen, I can't open the qvf file as I'm using QlikSense Web & Desktop. I don't have QlikView. Are you able to resend in qvw format?
If you need qvw file then you have qlikview not qlik sense. But unfortunetly I don't have qlikview.
If you copy and past the same script and change the file paths as it should be, it will work on qlikview.
Hi @kaanerisen, I have managed to open with Qlik Sense Desktop, but I'm still getting a synthetic error when I load the data. Am I supposed to ignore it?
I assume that you added the script to the app and there is a different script section on script editor. Because I see some geo tables which is created by qlik sense itself and fetch the data table twice.
Comment out the the other script part or delete the section itself and run again. It will work.
Hi @kaanerisen, there's an auto-generated section that i'm not able to comment out. Would this be the problem?
Definetely. I guess the script that I post is in main section. If it is, unlock the auto generated section, delete the section itself and load data. It will work.
Hi @kaanerisen, got it and the script has been incorporated into my existing one. Thank you very much!
Hi All, just wanted to ask a quick question. Basically I did three Noconcatenate tables to calculate the delta first then using if previous with rangesum and peek to do the cumulative delta calculation and then name Delta as the backlog type. But I realised that whenever I open my Qlik app, the Backlog Type = Delta will be missing from my straight table but after I reload the data, it will reappear. Then the same happens again if I close the Qlik Sense app and reopen again. Any ideas why this is happening and how to resolve it?