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

Set Analysis and Variables?

All-

How do I set up set analysis (with variables) to sum up specific values contained in the output of the variables?  Here's an example expression:

=sum({<Product.ProdName={'$(vProd1)'}>}

Product.ProdValue) + sum({<Product.ProdName={'$(vProd2)'}>}

Product.ProdValue) + sum({<Product.ProdName={'$(vProd3)'}>}

Product.ProdValue) + sum({<Product.ProdName={'$(vProd4)'}>}

Product.ProdValue)

The above expression works absolutely fine.  I need a totals column. That being said, the values contained in vProd1, vProd2, (so on...) contain either a "ProdA" or "ProdB" contained in the ProductName (which is pulled in based on the variable).  I need to sum up all values containing "ProdA" and sum up all values containing "ProdB" each in it's own column.  What's the best way of accomplishing this?

Also...  I have to imagine this can be highly intensive (or could be).  I've provided a highly shorted version of this expression above.  Additionally, there are always hundreds of Products being added everyday.  So, I don't want to run into an "Out of memory" situation.  So also looking for efficient ways of handling this situation as well.

Thanks!

12 Replies
swuehl
MVP
MVP

me again,

I just checked, for total of the four selections,

you could also write expression like

=sum({<Product={'$(vProd1)'}+{'$(vProd2)'}+{'$(vProd3)'}+{'$(vProd4)'}>} ProductValue)

instead of the four sums (like you used in OP).

And, to filter only ProdA containing variables, you might use

=sum({<Product=({'$(vProd1)'}+{'$(vProd2)'}+{'$(vProd3)'}+{'$(vProd4)'})*{'*ProdA*'}>} ProductValue)

(ProdB is trivial, of course)

Maybe this helps,

Stefan

Not applicable
Author

Stefan-

Thank you so much for all your help today. *Really* appreciate it. This definitely did it!

Thanks so much.

swuehl
MVP
MVP

You're welcome. I am glad we got a good solution for an interesting problem.

Good night,

Stefan