Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
User13
Contributor
Contributor

Need help with nested IFs

Hi,

I am trying to filter values based on selection from a drop down list in a way that if employee "B" is selected from dropdown list, table should show employee "B", his supervisor "A" and his direct reportees "C" and "D"

= IF([Supervisor ]='$(=GetFieldSelections(list))' OR [Employee]='$(=GetFieldSelections(list))'
OR [Employee]= (IF([Employee]='$(=GetFieldSelections(list))',[Supervisor ])),[Employee])

This expression is returning employee "B" and his reportees but not his supervisor 

Looks like there is some issue in this part

[Employee]= (IF([Employee]='$(=GetFieldSelections(list))',[Supervisor ]))

Can you please help to resolve this

EmployeeSupervisor
A 
BA
CB
DB
EC
  
Labels (3)
6 Replies
edwin
Master II
Master II

Assuming you are building a chart,

this gets you all the subordinates:
= count(DISTINCT {<Employee=, Supervisor={'$(=only(Employee))'}>}Employee)

this gets the supervisor:
= count(DISTINCT {<Employee=p({<Employee={'$(=only(Employee))'}>} Supervisor)>}Employee)

you can of course extrapolate from this using concat, etc..

 

hope that helps

Kushal_Chawda

@User13  try below

Create variable vEmployees on frond end with below expression

 

=Concat(distinct chr(39)&Employee&chr(39),',')

 

 

Then create below expression. Note that Employee and supervisors  both should present in dimensions

 

=Count({<Employee+=p({1<Supervisor={$(vEmployees)}>}Employee)>}Employee)

 

 

You can also use the set in actual expression. Let's say you have measure as Sum(Salary) then use below

 

=sum({<Employee+=p({1<Supervisor={$(vEmployees)}>}Employee)>}Salary)

 

Kushal_Chawda

@User13  use distinct keyword in concat function.. updated expression

User13
Contributor
Contributor
Author

Hi Edwin,

 

Thanks for your reply.

I am working on Org chart and trying to create functionality to search employees by name using dropdown list. I think we have to perform this in dimension field.

 

Thanks

User13
Contributor
Contributor
Author

Hi Kush,

Thanks for your reply.

I am working on Org chart and trying to create functionality to search employees by name using dropdown list. I think we have to perform this in dimension field.

Thanks

Kushal_Chawda

@User13  As I mentioned , You can add the Dimensions in your chart (Employee & Supervisor) and then  add the measure with set as I mentioned. You can provide filter of Employee to select any value.