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

Can any one explain below syntax with the following table?

Variable:

vdeptid=Concat(DISTINCT deptid,',')

Expresion in Bar chart:

=Avg({1<deptid={$(vdeptid)}>}sal)

Requirements:

1.Sum of salary of selected employee.

2.Avg salary of department, in which selected employee is working

3.Avg salary of all department.

EidEnameDeptidSal
101Bhargav101000
102Vishnu102000
103Vijay203000
104Subbu304000
105Sandeep405000
106Sravani406000
2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Create a text box object with =Concat(DISTINCT deptid,',') as text. That way you can see what the value of the variable is. The expression =Avg({1<deptid={$(vdeptid)}>}sal) uses the value of the variable so you get something like =Avg({1<deptid={10,20,30,40}>}sal), depending on the selections you make. You can also do this without the variable: =Avg({1<deptid=P(deptid)>}sal).


1.Sum of salary of selected employee: sum(sal)

2.Avg salary of department, in which selected employee is working:  avg({<deptid=p(deptid),ename=,eid=>}sal)

3.Avg salary of all departments:  avg({<ename=,eid=>}sal)


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks for ur explanation.