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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
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
tresesco
MVP
MVP

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

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

MK_QSL
MVP
MVP

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

Not applicable
Author

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.

MK_QSL
MVP
MVP

Quarter = {'$(Variable)'}

sunilkumarqv
Specialist II
Specialist II


Try this

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

maxgro
MVP
MVP

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