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: 
rcandeo
Creator III
Creator III

Why Is this Function not Working?

I am using an aggregation function and I am having problems in some cases.

The syntax that is not working is these:

sum(aggr(only(OpenValue),Document,DueDate)

+if(PaymentDate>AsOfDate,PayedValue,0))

If I take out the aggregation function gives the correct number:

sum(if(PaymentDate>AsOfDate,PayedValue,0))

Why the aggreation function is changing my results?

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

I don't think you can add an aggregation to an if statement. An aggregation returns a list of rows. The IF statement returns a single value. You can't add a single value to a list of rows.

I have no idea what you're actually trying to accomplish, but my guess is that you either need to move the IF inside the aggregation, or move the + outside of the sum.

View solution in original post

1 Reply
johnw
Champion III
Champion III

I don't think you can add an aggregation to an if statement. An aggregation returns a list of rows. The IF statement returns a single value. You can't add a single value to a list of rows.

I have no idea what you're actually trying to accomplish, but my guess is that you either need to move the IF inside the aggregation, or move the + outside of the sum.