Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ant_19
Contributor II
Contributor II

loop with multiple condition

Hi All,

just start with Qlik and I have my first question. I've been looking around but I did not found a suitable solution.

 

With a bucle I need to read all row in Table 1, for different Date I need to sum the values if same conditions are meet.

 

1st : if table 1. column A = N then it has to sum the value in column D without check column C

2nd: if table 1 column A is  NULL then get the data from column C  and sum he column D by text

I put an example:

this table (Table 1) is my actual table:

Datecolumn AColumn CColumn D
10/01/2019 CMDEP0,33
10/01/2019 CMDEP0,67
10/01/2019 CMDEP1
10/01/2019 CMDEP4,33
10/01/2019 CMDEV0,33
10/01/2019 CMDEP1,33
10/01/2019 CMDEP1,67
10/01/2019zCMDEZ3
10/01/2019NCMDEN8
10/01/2019 CMDEP3
10/01/2019 CMIEP4
10/01/2019 CMIEN1
10/01/2019 CMIEP4
11/01/2019 CMDEP6
11/01/2019 CMDEP9
11/01/2019 CMDEP8
11/01/2019 CMDEP6
11/01/2019 CMDEV3
11/01/2019 CMDEP4
11/01/2019 CMDEP2
11/01/2019 CMDEP0,6
11/01/2019 CMIEP5
11/01/2019 CMIEN11
11/01/2019 CMIEP3
11/01/2019zCMDEZ6
11/01/2019NCMDEN9

 

 

(Table 2): below the final result

DataCMDEPCMDEVCMIEPzN
10/01/201912,330,33838
11/01/201935,63869

 

I hope to have explain my problem correctly,

thanks in advantage for your help.

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

I understand. If you want to make a crosstable in the script from your
table then you can use generic load.

54157_Generic%20transformation4

Check out @hic Qlik design blog post from 2014, it is still a
good read.
https://community.qlik.com/t5/Qlik-Design-Blog/The-Generic-Load/ba-p/1473470

View solution in original post

4 Replies
Vegar
MVP
MVP

I created the pivot table below by using the following script:

image.png

 

Data:
LOAD
    Date,
    if(len(trim([column A]))>0, [column A] , [Column C]) as Dimension, 
replace([Column D],',','.') as [Value] FROM [https://community.qlik.com/t5/QlikView-App-Development/loop-with-multiple-condition/m-p/1554548#M440560] (html, codepage is 1252, embedded labels, table is @1);
Ant_19
Contributor II
Contributor II
Author

HI Vegar,

Thanks a lot, this is a nice solution, but the result is from the Table dialague is 

Capture.JPG

I need to have the final table with the script

Vegar
MVP
MVP

I understand. If you want to make a crosstable in the script from your
table then you can use generic load.

54157_Generic%20transformation4

Check out @hic Qlik design blog post from 2014, it is still a
good read.
https://community.qlik.com/t5/Qlik-Design-Blog/The-Generic-Load/ba-p/1473470

Ant_19
Contributor II
Contributor II
Author

HI,

yes, it help my a lot,

thanks again for your hepl

regards