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

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
derekjones
Creator III
Creator III

Unique Customers who have Sold on two areas

Hi All

I think I maybe tackling this the wrong way as I'm not getting any luck getting to the number I desire.

I'm trying to evalute the number of customers which have traded in more than one area in a given period.

Example, say we have 3 customers who trade with us, We have two sales floors, One North, one South. I have sales data that tells me which floor sold what to which customer. I want to know how many customers in a month trade with both floors i.e. Crossovers.

I've atached an example qvw. In there, for Jan, both Cust001 and Cust002 traded with both Areas, so the count of customers in 'Crossover' for Jan is 2. In Feb, only Cust002 sold on both Areas, so Count of Customer in Crossover is 1.To add a little more complexity, I also want to evaluate crossover by Item. So in my example, if you select Item 3, you'll see in Feb it traded with both Areas for Cust002.

I've tried using an AGGR function with a Countif, but I think there must be a smarter way of doing this.

Can anyone give me any ideas.

My thanks in advance

Derek

1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

Derek, I think you can just use the name of the cycle group in aggr directly. It will underline it in red but I think it will work.

Regards,

Vlad

View solution in original post

4 Replies
vgutkovsky
Master II
Master II

Try this:

count(distinct
aggr(
if(count(distinct Area)>=2,Customer)
,Customer,Month
)
)

Regards,

Vlad

derekjones
Creator III
Creator III
Author

Thanks Vlad

Good idea doing a count on area, works for this scenario.

I've now got a further issue with this problem I'm hoping you can help with. The aggr function works well when you have a table with 'Static' dimensions i.e. If I added in the field Item to the table, then I have to add 'Item' to the aggr function like so..

count(distinct
aggr(
if(count(distinct Area)>=2,Customer)
,Customer,Month,Item
)
)

However, in my real life example, I have multiple dimensions in a cycle group e.g. Item, Category, Manufacturer etc which I would like to be able to cycle through giving the different crossover results. However this doesn't seem possible to do as the aggr function requires you to know the dimension being used to count correctly.

My thanks again for any suggestions.

Derek

vgutkovsky
Master II
Master II

Derek, I think you can just use the name of the cycle group in aggr directly. It will underline it in red but I think it will work.

Regards,

Vlad

derekjones
Creator III
Creator III
Author

Thanks Vlad

You are a legend!

That worked a treat by the looks of it. Never knew it would work as it wasn't recognising the cycle group, Qlikview should really update their autocomplete to include these so people know they can use cycles.

All the best.

Derek