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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

set analysis : expression within it?

Hello everyone!

Thank you so much for taking the time to read my question and potentially answer it!

I am still trying to figure out set analysis; is there a way that you can have an equation within the expression that then removes certain values?

For instance, if I have the following columns (Fruit, Veggie, CountofFruit,) and only want to sum the CountOfFruit when the veggie field is populated, how would I do that?

Fruit          Veggie          CountofFruit

Apple                              10

Apple          Carrot          5

Pear           Lettuce          12

Pear                                   1

So I want to return the value 17 (from 5+12).  Would the following equation work? And if not, what else could I do to be able tot do this?

=sum( {<len(veggie) = {">0"} >} CountofFruit)

Thanks!

2 Replies
sunny_talwar

I would create a flag in the script to handle this

LOAD Fruit,

           Veggie,

          If(Len(Trim(Veggie)) = 0, 0, 1) as Flag

          CountofFruit

FROM ....;

and then this:

=Sum({<Flag = {1} >} CountofFruit)

Anil_Babu_Samineni

Or May be front end

Sum({<Veggie -= {''}>}CountofFruit)

Or

Sum({<Veggie = {'*'}-{''}>}CountofFruit)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful