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: 
silvacarlos
Creator II
Creator II

Help with an expression

Hi guys I need your help,

 

I have this table 

N_PURCHASEID_USERACTION
1AAPP
1BGIFT
1CGIFT
1DCOUPON
2AAPP
2BAPP
3AGIFT
3BAPP

 

In a KPI I need to count N_PURCHASE =2 but when N_PURCHASE=1 AND ACTION = GIFT. In this case this count should results 1, only ID_USER=B 

 

I hope you can understand this,

 

Thanks in advance!

 

CS

1 Solution

Accepted Solutions
sunny_talwar

May be this

Count(DISTINCT {<N_PURCHASE = {2}, ID_USER = P({<N_PURCHASE = {'1'}, ACTION = {'GIFT'}>})>} ID_USER)

View solution in original post

4 Replies
sunny_talwar

You want a count N_PURCHASE = 2? How are you getting this?

silvacarlos
Creator II
Creator II
Author

I want a count of Users that have N_PURCHASE = 2 but previously (N_PURCHASE =1) they have ACTION = GIFT. In the example the only user that have this conditions is user B

I hope you can understand this, if not I'll try to show another example

CS
sunny_talwar

May be this

Count(DISTINCT {<N_PURCHASE = {2}, ID_USER = P({<N_PURCHASE = {'1'}, ACTION = {'GIFT'}>})>} ID_USER)
silvacarlos
Creator II
Creator II
Author

This is what I wanted!

 

Thank you so much Sunny as always

 

CS