Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Using if, sum, Total in the same Expression

I have an expression as

sum(Total<A,B,C>Revenue)

I want to put an if condition in the same. When i put if condition in beginning like:

if(Quarter='Q1', sum(Total<A,B,C>Revenue),0)

it does not give any result.

How should i write the expression for it to work.

6 Replies
MVP
MVP

Re: Using if, sum, Total in the same Expression

Had you have a dimension Quarter, your expression would work. Else, try like:

=Sum( TOTAL <A,B,C> If(Quarter='Q1', Revenue,0))

Re: Using if, sum, Total in the same Expression

=SUM(TOTAL <A,B,C> {<Quarter = {'Q1'}>} Revenue)

Not applicable

Re: Using if, sum, Total in the same Expression

Hi Manish,

In Quarter I am trying to use an Alphanumeric variable. Its not working for that. Any change in syntax required?

Thanks and Regards,

Gaurang.

Re: Using if, sum, Total in the same Expression

Quarter = {'$(Variable)'}

sunilkumarqv
Valued Contributor II

Re: Using if, sum, Total in the same Expression


Try this

=if(Qtr>0,sum(Total<A,B,C> )Revenue)

MVP
MVP

Re: Using if, sum, Total in the same Expression

sum({$ <Quarter={'$(var)'}>} TOTAL <A,B,C> Revenue)

Community Browser