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

Announcements
April 13–15 - Dare to Unleash a New Professional You at Qlik Connect 2026: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Incorrect expression

Hello guys,

The following is a pivot table chart type. If you notice, the Days column summation is incorrect (in which is should be 31 + 31 + 422 = 468). The following is the expression I'm using for the Days column.

IF(InvUOMCode='MTH' OR InvUOMCode='EA' OR InvUOMCode='LT' OR InvUOMCode='SET' OR ISNULL(InvUOMCode) or InvUOMCode=''
,
SUM(InvQuantity)
,(
DAY(MONTHEND(MAKEDATE(YEAR(CDate),MONTH(CDate))))))  

Can somebody help me to point out where I done did wrong on my expression?

Thank you very much for your kind attention guys.

2 Replies
tresesco
MVP
MVP

Re-write expression using aggr() like:

=Aggr(Sum(IF(InvUOMCode='MTH' OR InvUOMCode='EA' OR InvUOMCode='LT' OR InvUOMCode='SET' OR ISNULL(InvUOMCode) or InvUOMCode=''
,
SUM(InvQuantity)
,(
DAY(MONTHEND(MAKEDATE(YEAR(CDate),MONTH(CDate)))))) ), Country, [Fixed Asset Code], [Project Code], [Invoice Date], [InvoiceNo/...] , UOM)

Note: replace '[InvoiceNo/...]' with proper field name.

Anonymous
Not applicable
Author

Try below,

IF(InvUOMCode='MTH' OR InvUOMCode='EA' OR InvUOMCode='LT' OR InvUOMCode='SET' ORISNULL(InvUOMCode) or InvUOMCode=''
,Aggr(
SUM(InvQuantity), Country, [Fixed Asset Code], [Project Code], [Invoice Date], [Invoice No], UOM)
,(
DAY(MONTHEND(MAKEDATE(YEAR(CDate),MONTH(CDate))))))