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

How to count of variable A, grouped by variable B

Hello! Thank you in advance for any and all help! I currently am setting up a chart where I have a list of instances of coffee buyers, the amount they purchase, and the amount they spend.  I would like to create a sheet object where I can select all of the coffee buyers who spend above a certain amount (say $14).  Does anyone know how to do this?  I've tried using the trigger field in variables, but the search string field doesn't seem to like/work having an if statement in it.

For more clarifcation, my chart looks like this:

Coffee buyer       amount purchased     amount spent     

     A                         5 kilo                              10

     B                         7 kilo                              8

     C                        15 kilo                              20

     B                         6                                    7

     D                         10                               15

    A                            .5                                  1

How would I be able to select all coffee buyers who spend less than $14 (ie select all coffee buyers but A)

Thank you!

3 Replies
sunny_talwar

May be use set analysis

Dimension

Coffee buyer

Expressions

Sum({<[Coffee buyer] = {"=Sum([amount spent]) < 14"}>} [amount purchased])

Sum({<[Coffee buyer] = {"=Sum([amount spent]) < 14"}>} [amount spent])

Anonymous
Not applicable
Author

Hi! Thank you for your response! And I would write that in the script then?

Anonymous
Not applicable
Author

Though .. would I be able to let the user change the 14 in the end?