Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression duplicating the sum

Dear Expert,

Please find the attached app and screen capture on expression sum(QTY)=16 in actual records but it duplicate the record and resulting in wrong result. aggr(avg()) also result in wrong result.Also variable in set analysis not resulting properly. Help me to get proper result.

Thanks

Ashif

problem.png

4 Replies
Gysbert_Wassenaar

Create a table with ZDES_DESC and QTY as dimensions and Count(QTY) and Sum(QTY) as expressions. Then tell us what the correct result should be of sum(QTY) for the dimension value ENGINEER in the dimension ZDES_DES.


talk is cheap, supply exceeds demand
Not applicable
Author

Dear Gysbert,

Result should be one but Count(QTY) and Sum(QTY) giving wrong result.

p.png

Thanks

Ashif

Gysbert_Wassenaar

Count(QTY) and sum(QTY) give the correct result.

Count(QTY) is 62 for QTY value 0 because your data model has 62 records where QTY has value 0.

Count(QTY) is 250 for QTY value 1 because your data model has 250 records where QTY has value 1.


Sum(QTY) is 0 for QTY value 0 because 62 * 0 = 0.

Sum(QTY) is 250 for QTY value 1 because 250 * 1 = 250


talk is cheap, supply exceeds demand
Not applicable
Author

HI Gysbert,

If I use Count(aggr(QTY,KEY8)) it gives proper result. So i need to review my data model once again.

Thanks Gysbert.