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: 
Not applicable

I need help! Doing a count by an expression!

I created a graphic with the following expression:
If ([Value] = 0 'Not bought', 'bought')

The size of this graph are codes of clients, because I'm considering whether my customer bought or not.
I wonder how would do to make the count of customers, how many customers have purchased and how many customers did not buy!

I can do a count of a speech!

Thanks!

2 Replies
Not applicable
Author

if customers have not bought

=count(distinct If ([Value] = 0, customer_code))

if customers have bought

=count(distinct If ([Value] > 0, customer_code))

otherwise you can use a flag when you are loading the script

LOAD

If ([Value] = 0, 'Not Bought', Bought) as cust _flag

From Table x;

the expression would be if customers have bought

=count(distinct If ([cust _flag ='Bought', customer_code))

Not applicable
Author

Hi,

I will make such changes and respond if it worked!

Thank you for your attention!