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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement on Set Analysis

Can somebody help?  I have two tables:

Table1:

GroupA, ID

Employees-Male, 1

Employees-Female, 2

Managers, 3

T_Employees, 4

T_Managers, 5

Overall, 6

Table2:

GroupB, ID, Count

Employees-Male, 1, 150

Employees-Female, 2,  200

Managers, 3,  25

What I would like to get an expression on is if I select fields in Table1:

Employees-Male - Count is 150

Employees-Female - Count is 200

Managers - Count is 25

T_Employees - Count is 350 (sum of male & female)

T_Managers - Count is 25 (Managers)

Overall - Count is 375 (all)

I'm thinking if statements in Set Analysis but not sure how to do it.

I already have this expression to begin with which outputs the count as field in Table1 is selected which solves the first three.

sum({<Table2= P(Table1)>} Count)

Since Table2 is just a subset of Table1, the last three (T_Employees, T_Managers, and Overall) is zero.  I probably need to add conditions (IF statements) to satisfy conditions.

Any help would be appreciated.

10 Replies
Not applicable
Author

it worked.  just had to delete the $ sign.

If(GroupA= 'T_Employees', Sum({<GroupB= {'Employees-Female', 'Employees-Male'}>} Count)), If(GroupA='T_Managers', Sum({<GroupB= {'Managers'}>} Count)), Sum(Count)))