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: 
Saiteja1
Contributor III
Contributor III

Sum of some particular countries using set analysis

Hi..,

I have a scenario

we have two fields

Country ,Sales
India, 1000
UK ,3000
Ireland ,5000
Japan ,2000
Japan ,9000
APAC ,2000
UKI ,3000
AFR ,7000
Uganda, 8000

I need sum of sales of Japan,UKI,AFR,Ireland using set analysis

Thanks in advance

Labels (1)
2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Vegar
MVP
MVP

If you have many countries you might consider creating a field/flag in the data model for grouping them together. Consider adding an Country dimension to your data model.

Country , inKpiCountry
India, No
UK , No 
Ireland ,Yes 
Japan ,Yes 
APAC ,No 
UKI ,Yes 
AFR ,Yes 
Uganda, No

Then use the following expression:

Sum({<inKpiCountry={'Yes'}>}Sales)

View solution in original post

5 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Sum({<Country={'Japan','UKI','AFR','Ireland'}>}Sales)

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

Saiteja1
Contributor III
Contributor III
Author

Hi rwunderlick,

Thanks for your solution 

if we have 10 to 20 countries we can write like your solution but if we have more than 50 countries then ??

Vegar
MVP
MVP

If you have many countries you might consider creating a field/flag in the data model for grouping them together. Consider adding an Country dimension to your data model.

Country , inKpiCountry
India, No
UK , No 
Ireland ,Yes 
Japan ,Yes 
APAC ,No 
UKI ,Yes 
AFR ,Yes 
Uganda, No

Then use the following expression:

Sum({<inKpiCountry={'Yes'}>}Sales)

Saiteja1
Contributor III
Contributor III
Author

Thanks Vegar

d33paklala
Contributor II
Contributor II

Never hardcoded the country names. Either create a variable or create a flag as vegar suggested.