Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Distinct Count

Hi all

i write an expression for counting distinct customers who bought from us with two condition:

1)  at least they bought 1 product from us

2) our sales to them minus sales returns be greater than zero

so i write this:

sum(aggr(DISTINCT(if((sum(SalesQTY*Price)>0) and ((sum(SalesQTY*Price)-sum(SalesReturnsQTY*Price))>0,1,0)),Customer's ID))

i used Date (YY-MM) as dimension but it shows me "No data to display"!

is my formula right?

tnx in advance

19 Replies
Anil_Babu_Samineni

Can you please share application if possible that demonstrates the issue?

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
Sergey_Shuklin
Specialist
Specialist

Hello, Ahmad!

May be clue in the brackets?

sum(aggr(DISTINCT(if((sum(SalesQTY*Price)>0) and ((sum(SalesQTY*Price)-sum(SalesReturnsQTY*Price))>0,1,0)),[Customer's ID]))

Not applicable
Author

Qlikview 11

Anil_Babu_Samineni

I didn't ask you provide the s/w version any more? I am asking about application whether how work around is going on and where we need to resolve the issue.

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

Hi Sergey

No, i tried, it does not work

Sergey_Shuklin
Specialist
Specialist

So, try this condition:

sum(aggr(distinct sum(if(sum(aggr(SalesQTY*Price,Customer))>0 and (sum(aggr(SalesQTY*Price,Customer))-sum(aggr(SalesReturnsQTY*Price,Customer)))>0,1,0)), Customer))

Not applicable
Author

i used a bar chart to shows data

recently our It team change the Qlikview version to 12 on server but right now i'm using version 11

the odd thing is when i open my chart on the server it works perfectly but in my PC or any other device it does not work!!

before they upgrade to version 12, it was working great. is it possible that upgrading version cause this?

Sergey_Shuklin
Specialist
Specialist

Or make it simle:

Count(distinct {<Customer_bought={">0"}>}Customer)-Count(distinct {<Customer_returned={">0"}>}Customer)

Not applicable
Author

No luck with this either