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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

Distinct Count Issue

Hi All,

In one line my requirement is I want to get something like this:

Count (*)

from

(select distinct OrderNumber,OrderLine

from Table);

If you check above pic. I have Two Order no : 042115 and 042116.

For 042115, the distinct count OrderLine = 3 and

for 042116, the distinct count OrderLine = 2.

So in count I need 3+2. and I want plot only this count in Separate Bar Chart.

Could anyone please help me to get this.

Thanks,

Sarif

1 Solution

Accepted Solutions
Anil_Babu_Samineni

How can I make the Set Expression.

May be this

Sum(Aggr(Count({<AHPLotID = {"=Count(AHPLotID) > 0"}>} Distinct OrderLine), OrderNumber))


Note: I request you to mark as helpful and close this thread by flag of Vishwarath Answer.


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

View solution in original post

13 Replies
avinashelite

Add a expression like

count(DISTINCT AHPLotID) that should work for you

mhmmd_srf
Creator II
Creator II
Author

No Avinash... it will give me 8. Not 5.

avinashelite

remove the AHPLotID column

mhmmd_srf
Creator II
Creator II
Author

Hi Avinash,

I need this in single KPI, like Text Box. So I guess we need to handle in expression.

Please help.

Thanks,

Sarif

Anil_Babu_Samineni

May be this?

Aggr(Count(DISTINCT OrderLine), OrderNumber)

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
avinashelite

share the sample app let me check your data set and get back to you

mhmmd_srf
Creator II
Creator II
Author

Hello Anil,

This is not returning anything.

Please help.

Thanks,

Sarif

vishsaggi
Champion III
Champion III

Try this in text box may be?

= Sum(Aggr(Count(Distinct OrderLine), OrderNo))

Anil_Babu_Samineni

Check this then

Sum(Aggr(Count(Distinct OrderLine), OrderNumber))

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