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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of rows and expression total are different

I have  below expression in Bar chart and Straight table...in straight table when I sum the rows I get different numbers and in bar chart I get different numbers however when I do expression total in straight table they match.

How  can I do the same sum in bar chart ?

(if(ABRBuildingCode =  'THOM-B5635',22,

IF(Capacity-((count(if(len([EM EmpName])=0,

          IF([RoomTypeAssigned]='OFFICE',

              UniqueAB2Key)))

                          +

      count(if(len([EM EmpName])=0,

          IF([RoomTypeAssigned]='WRKST',

              UniqueAB2Key))))) = 0

or COUNT(distinct (UniqueAB2Key)) =0,

     sum([AB1BuildingCpacity(Manual)]),

      COUNT(distinct (UniqueAB2Key)))))

11 Replies
sunny_talwar

Can you share some screenshots to show the discrepancy?

Not applicable
Author

Capture1.GIF

Expression total for Space type Office

Capture2.GIF

Sum of rows for space type office

Capture3.GIF

sunny_talwar

How about Add Sum(Aggr()) around the expression?

=Sum(Aggr(

(if(ABRBuildingCode =  'THOM-B5635',22,

IF(Capacity-((count(if(len([EM EmpName])=0,

          IF([RoomTypeAssigned]='OFFICE',

              UniqueAB2Key)))

                          +

      count(if(len([EM EmpName])=0,

          IF([RoomTypeAssigned]='WRKST',

              UniqueAB2Key))))) = 0

or COUNT(distinct (UniqueAB2Key)) =0,

     sum([AB1BuildingCpacity(Manual)]),

      COUNT(distinct (UniqueAB2Key))))),


Dimensions))

Not applicable
Author

Sum(Aggr(

(if(ABRBuildingCode =  'THOM-B5635',22,

IF(Capacity-((count(if(len([EM EmpName])=0,

          IF([RoomTypeAssigned]='OFFICE',

              UniqueAB2Key)))

                          +

      count(if(len([EM EmpName])=0,

          IF([RoomTypeAssigned]='WRKST',

              UniqueAB2Key))))) = 0

or COUNT(distinct (UniqueAB2Key)) =0,

     sum([AB1BuildingCpacity(Manual)]),

      COUNT(distinct (UniqueAB2Key))))),


ABRUsage))


I tried that..that didnt do any diff

sunny_talwar

Are you trying to show 65,229 in the bar chart?

Not applicable
Author

Yeah.

Not applicable
Author

stalwar1‌Why would I get different counts ?

sunny_talwar

I think the issue might be related to the distinct count and/or the if statements. I will have to play around to give the exact answer

Not applicable
Author

Ok.Please let me know if you come up wit something.Thanks much.