Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum if in Pivot table

Hi All,

Please let me know how to use column() or column name  in sum if statement 

Example 

Sum(if(Indicator='N', Column(16))

or 

Sum(if(Indicator='N', [Column Name])

I am not able  to use both statement in sum if statement 

Thanks in advance

Labels (2)
7 Replies
r3iuk
Creator
Creator

I think all you might need an extra ')' at the end of the statement?

Sum(if(Indicator='N', Column(16)))

or 

Sum(if(Indicator='N', [Column Name]))

It might be useful to see your expression in the column being referenced and what kind of outcome you are trying to achieve.

vmoreno2605
Creator
Creator

It would be useful to see your pivot table
sunny_talwar

Is Column(16) an expression or just a field name? If it is an expression involving Sum, Avg, Min, Max or any kind of aggregation, then this might not really work for you because you will be doing Aggregation over an aggregation. May be a sample might help us understand what you are trying to do to help you better here.
marcus_sommer

You could use something like:

if(Indicator='N', Column(16))

but not within aggregation-functions like sum(). If you really want to apply an aggregation you need to use your origin expression - probably wrapped with an aggr() function like:

sum(aggr(YourOriginExp, Dim1, Dim2))

- Marcus

Anonymous
Not applicable
Author

Thanks for the reply,

can you send me the syntax or sample code with ')'

 

 

 

 

Anonymous
Not applicable
Author

Hi,

Thanks for the reply.

Yes the column(16) has the below expression with OR condition


sum({<[Indicator={'Y'}>}HC * [Better Estimate_Input]
+
(sum({<[Indicator={'N'}>}HC_Input)* AVG({<[Event Id]={'BAM','BAT'}>} [PY TC US]) )
)

 

next column i am using the sum if statement 

sum(if(indicator='N', column(16)).

Reason using Sum if is, user inputing mulitple values in the front end / table box 

 

sunny_talwar

Do you have Indicator as one of your dimensions in the chart?