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

Announcements
Solving the Informatica Dilemma: On-Demand Briefing - Watch On Demand!
cancel
Showing results for 
Search instead for 
Did you mean: 
Arun_141
Contributor III
Contributor III

Total and Subtotal not matching in Pivot Table

kumar_72_0-1747849300977.jpeg

I am calculating a measure in the Pivot table, but the value in the total and sub total is not summing the corresponding value of the cells. The measure i am using is 

Employee Contribution  - COUNT(distinct Emp)/COUNT(TOTAL <Emp> distinct Project )

I want subtotal for Project and total for Domain should add the employee contribution e.g. for Project A subtotal should be 1.25 (0.25+1.00) instead of 0.50 , total for Domain D1 should be 1.50(0.25+1.00+0.25) instead 0.75, similarly for Domain B. Below is the sample data.

Thank you for your help.

Sample data:

Load * Inline [
Domain,Project,Employee
D1,A,Emp1
D1,A,Emp2
D1,B,Emp1
D2,C,Emp1
D2,D,Emp3
D2,D,Emp1
];

1 Solution

Accepted Solutions
aruneshgupta
Creator
Creator

Hi,

You may try below expression.. Hope you get expeted result 

sum(
Aggr(
Count(Distinct Employee) / Count(Total <Employee> Distinct Project),
Project,Employee,Domain
)
)

 

Regards,

Arunesh Kumar 

View solution in original post

2 Replies
aruneshgupta
Creator
Creator

Hi,

You may try below expression.. Hope you get expeted result 

sum(
Aggr(
Count(Distinct Employee) / Count(Total <Employee> Distinct Project),
Project,Employee,Domain
)
)

 

Regards,

Arunesh Kumar 

Arun_141
Contributor III
Contributor III
Author

Thanks Arunesh, your solution worked perfectly fine.