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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate with pivot table

Hi all.

I have a pivot table with to calculations that doesen't give me the right value.I have the right values for every row when I expand the table but when the table is collapsed the "total" is wrong. Se example below:

collapsed.bmp

expand.bmp

Expression for num days:

count({$<Salary_ID={'col'}, Absence_ID={'vac'}>} DISTINCT Start_Date)

Expression for Value:

(count({$<Salary_ID={'col'}, Absence_ID={'vac'}>} DISTINCT Start_Date))*(sum({$<Salary_ID={'col'}, Absence_ID={'vac'}>} Unit_Price))

Suggestions to solve this?

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Well, technically the totals are correct. You did ask for distinct start dates. Perhaps you want something like this instead: sum(aggr(count({$<Salary_ID={'col'}, Absence_ID={'vac'}>} DISTINCT Start_Date), Account_..., Home_CC,Employee_ID))


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Well, technically the totals are correct. You did ask for distinct start dates. Perhaps you want something like this instead: sum(aggr(count({$<Salary_ID={'col'}, Absence_ID={'vac'}>} DISTINCT Start_Date), Account_..., Home_CC,Employee_ID))


talk is cheap, supply exceeds demand
Not applicable
Author

Perfect! But how to solve the next expression for the column Value?

(count({$<Salary_ID={'col'}, Absence_ID={'vac'}>} DISTINCT Start_Date))*(sum({$<Salary_ID={'col'}, Absence_ID={'vac'}>} Unit_Price))

Not applicable
Author

Thanks a lot Gysbert for your reply. I solved the second question I had.