Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Eid | Ename | Deptid | Sal |
---|---|---|---|
101 | Bhargav | 10 | 1000 |
102 | Vishnu | 10 | 2000 |
103 | Vijay | 20 | 3000 |
104 | Subbu | 30 | 4000 |
105 | Sandeep | 40 | 5000 |
106 | Sravani | 40 | 6000 |
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)
Thanks for ur explanation.