Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I've been running into a problem I can't seem to work out. I need to count the number of transactions that only contain a treatementcode('K'). A transaction can have many treatment codes, but I only want to distinct count a transaction number if it only contains a 'K'. If it contains another code, it shouldn't get counted. I have tried using only(), but it doesn't seem to work for me the way I want it to. Could you help me with this?
I distinct count a combination field of transaction number &"|"& customer number
Thanks in advance!
Ah right yes that makes a bit more sense then with that example. Have a look at the attached, you'll need to use Aggr for this.
Hope that helps
Joe
Hi Gregoor,
something like the below set analysis should work for you
Count({<treatementcode={"*K*"}>} Distinct [transaction number])
hope that helps
Joe
also you might find this
http://community.qlik.com/docs/DOC-4951
useful for more info on set analysis
Joe
Hi Joe, Thanks for the quick answer. I think your first suggestion isn't exactly what I'm looking for. That way gives me the same results as my current set analysis, which only counts 'K' lines, regardless of other treatment codes. A little example might clarify.
Let's say I have this data:
ID Transaction# TreatmentCode
1 1 R
2 1 K
3 2 K
4 3 R
5 3 K
What I'm looking for it counting only ID 3, since it only contains a K. The other 2 transcations should not be counted.
Maybe I have already constructed the right set analysis by accident, but I can hardly imagine I did. Just printed your document to study it, thanks for that link!
Ah right yes that makes a bit more sense then with that example. Have a look at the attached, you'll need to use Aggr for this.
Hope that helps
Joe
Thanks! That is exactly what I'm looking for, now to just edit it to work in my dashboard