Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
goro2010
Creator
Creator

If Expression - Distinct Count

Good Day,

I need help with the following.

11.PNG

I have got my expression correct of the total buying customers, my problem is that I am struggling to get the buying customers correct, what the expression must do is the following:

If "Customer Number" have 1 or more of a product bought, then only do the distinct count, else do not count the "Customer Number".

Thank you for the support!!

Kind Regards,

Jan

19 Replies
Anil_Babu_Samineni

Would you provide data and expected result, please?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
goro2010
Creator
Creator
Author

Hello, I have attached the documents and made some screen shots below:

So this is the data of the available products.

14.PNG

There is 4 customers in total that bought something and 3 is from the SSD group. As per picture below:

13.PNG

So the result that I am looking for needs to be the following:

Total Customer Bought: 4 (This part I am getting correct)
Productid 6541 - Total Qty (12) - 3 Customers Bought Out of 4 (75% Bought) - This is where I am going wrong, I do get 4 everytime.

Thank You!

goro2010
Creator
Creator
Author

This is my expression also, as I filter by date.

=If(GetSelectedCount(OrderDate), Count(DISTINCT [account with Prefix]),0 )

Thank You

goro2010
Creator
Creator
Author

Of My original post, of the 3 867 customers, only 520 have bought SSD. So the answer should have been 14% and not 100%

prieper
Master II
Master II

COUNT(DISTINCT CustomerNumber) is probably too simple, would make sense to disclose, how the datamodel would look like and how you do calculate the "Total No Customers" then. Is ProFilter the product?

goro2010
Creator
Creator
Author

Good Day,

productId would be the table for all listed products that is available.

Thank You

Anil_Babu_Samineni

Here, Can you describe more for 6541 which is result. May be this?

=If(GetSelectedCount(OrderDate) >= 1, Count(DISTINCT [account with Prefix]),0 )

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

Can you try like:

= If(GetSelectedCount(OrderDate) > 0, Count(DISTINCT [account with Prefix]), 0 )


Else Can you share a sample to look into?

goro2010
Creator
Creator
Author

Hello,

I have made another example of what I am trying to achieve.

As per this picture below, I am doing an Distinct count to see how many customers are linked to the warehouse, this should show every time 50, currently it only shows who bought as per the right hand side table.

So the expression should be something like this...

All customers linked to "Warehouse" get Distinct count and populate that number to each "item", then do a count of "customers" against each "item" - I hope this makes sense.

16.PNG

Thank You