Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sonalbjr
Contributor
Contributor

Qlikview

In Qlikview, I want to calcultae certain sumifs for each unique code. If I am using the below code, I am getting the sum for all the codes together. How to segregate according to each code?

Load

Sum[(If[ABC]=XYZ, [Amount], 'NA']

Resident originaltable

Group By ABC

 

 

 

1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi,

You have to do it the outer way around, try this:

originaltable:
Load * Inline [
ABC, Amount
XYZ, 1230
XYZ, 573
XYZ, 1234
XYZ, 12
AAB, 1203
DSD, 832
];

NoConcatenate
Table:
Load
    ABC,
    IF( ABC = 'XYZ',
         Sum( Amount ),
         'NA'
    )                     as Amount
Resident originaltable
Group By ABC
;

Drop table originaltable;

exit script;

I've added a test table for showing that it works.

Jordy

Climber

Work smarter, not harder

View solution in original post

3 Replies
JordyWegman
Partner - Master
Partner - Master

Hi,

You have to do it the outer way around, try this:

originaltable:
Load * Inline [
ABC, Amount
XYZ, 1230
XYZ, 573
XYZ, 1234
XYZ, 12
AAB, 1203
DSD, 832
];

NoConcatenate
Table:
Load
    ABC,
    IF( ABC = 'XYZ',
         Sum( Amount ),
         'NA'
    )                     as Amount
Resident originaltable
Group By ABC
;

Drop table originaltable;

exit script;

I've added a test table for showing that it works.

Jordy

Climber

Work smarter, not harder
Sonalbjr
Contributor
Contributor
Author

Thanks  🙂 It worked

JordyWegman
Partner - Master
Partner - Master

Great, please mark the post as solved so other people can see this solves your issue!

Jordy

Climber

Work smarter, not harder