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: 
khadijaceesay
Contributor
Contributor

Pivot table sums are incorrect

I created a measure with the expression below and added it to a pivot table:

if (Index(concat(CorrDimNum),'d')>0,
if(LocationType = 'S' ,
sum(CorrSqFeetShipped),
Sum(CorrGoodSqFeetProduced)
),Sum({$<[LocationType]-={'S'}>}CorrGoodSqFeetProduced))


For some reason the subtotal rows when I collapse the pivot table are not properly summing the rows within the section. Total shows 90,340,989 instead of 96,900,981. Any idea how I can fix this?

khadijaceesay_0-1730384136806.png

 

Labels (1)
1 Solution

Accepted Solutions
khadijaceesay
Contributor
Contributor
Author

I solved this issue by wrapping my measure expression in a sum(aggr() function and listing all possible categories for the visual. New formula for measure is below.

 

sum(aggr((if (Index(concat(CorrDimNum),'d')>0,
if(LocationType = 'S' ,
sum(CorrSqFeetShipped),
Sum(CorrGoodSqFeetProduced)),
Sum({$<[LocationType]-={'S'}>}CorrGoodSqFeetProduced))),SalesRegionName,SalesAreaName,PlantName,CorrWorkWeek))

View solution in original post

2 Replies
khadijaceesay
Contributor
Contributor
Author

I solved this issue by wrapping my measure expression in a sum(aggr() function and listing all possible categories for the visual. New formula for measure is below.

 

sum(aggr((if (Index(concat(CorrDimNum),'d')>0,
if(LocationType = 'S' ,
sum(CorrSqFeetShipped),
Sum(CorrGoodSqFeetProduced)),
Sum({$<[LocationType]-={'S'}>}CorrGoodSqFeetProduced))),SalesRegionName,SalesAreaName,PlantName,CorrWorkWeek))

seanbruton

Superb !!! Neat Solution.