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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

if statement issue

Hi all,

my expression is..

If(Field1=$(vVariable1))'), sum(.......

vVariable1 holds a list of other variables which have the text stored in them.

I can't upload the data, and ive been trying to get a sample together but with no luck.

Thanks

6 Replies
hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

anyone?

marcus_sommer

Generally vVariable1 must return a list like 'A', 'B', 'C' .... and then try:

If(Pick(Field1,$(=vVariable1)) = 'Text'), sum(.......

- Marcus

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Thanks Marcus,

The expression i have is correct as it works for a row by row basis, but it just doesn't give a total

Not applicable

did you try  sum of rows on the expression for total instead of expression total ?

marcus_sommer

You need to aggregate your expression like:

sum(aggr(If(Pick(Field1,$(=vVariable1)) = 'Text'), sum(.......)), Dimension1, Dimension2))

- Marcus

Anonymous
Not applicable

Hi,

You may have to use Aggr() function to achieve total. Something like below,


Sum(Aggr(Sum(If(Pick(Field1,$(vVariable1)) = 'Text', .......)), $(vVariable1)))


If you using different dimension in your report, you may replace $(vVariable1) with your dimension in aggregation.