Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to aggregate based on Condition

Hello All,

I have one flat file with the following fields

   

TRNIDTRNFLGBSFLGPRDTYPEADDAMTORGAMT
1DS9002210003000
2DAB9003320002000
3CS9002625001500
4DB900213500800
5DAS900214000600
6DS900262000400
7DB900242700300

using load statement ,I wanted to calculate :

1. SUM(ADDAMT)  when TRNFLG in('D','DA','C','E')

2. SUM(ORGAMT)  when TRNFLG='D' and BSFLG='S' and  PRDTYPE in(90022,90021,90033,90026)

Can you help if I can get both the values calculated and displayed in Qlikview

Regards

Paul

Message was edited by: Paul Reddy

3 Replies
andrey_krylov
Specialist
Specialist

Maybe using set analysis

1. SUM({< TRNFLG={'D','DA','C','E'} >}ADDAMT)

2. SUM({< TRNFLG={'D'}, BSFLG={'S'},  PRDTYPE={'90022','90021','90033','90026'} > }ORGAMT)

Anonymous
Not applicable
Author

‌thank you Andrey. Do I add this in load script?

andrey_krylov
Specialist
Specialist

No Paul, these expressions are for chart. You can do something similar in load script, but what for? Could you please clarify the issue?