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: 
cliff_clayman
Creator II
Creator II

How do I get an average from a Count Distinct?

I need to get the average for this expression, but it gives me an error that nested aggregation is not allowed:

=COUNT(DISTINCT([Driver ID]))

How can I get the average for this?

19 Replies
cliff_clayman
Creator II
Creator II
Author

I need to add the value for Vendor into my Count Distinct expression.  Yes, I'm being vague because this is for work and I can't share that data.

sunny_talwar

I think we might have had this discussion 4 times before this.... no one is asking for your confidential proprietary data my friend... all we are asking for is a dummy mocked up data which can help us understand what you have so that we can give you a solution which works for you.... 

cliff_clayman
Creator II
Creator II
Author

I understand, but it would take a lot to put together a sample qvw for this.  I think all I need at this point is to add the Vendor value to the Count expression because when I select the proper Vendor from my Selection Criteria, I get the correct number.

sunny_talwar

Hahahaha okay.... it will take a lot for me to respond without knowing much.... will let someone else help.

Have a great weekend.

Best,

Sunny

cliff_clayman
Creator II
Creator II
Author

Your initial answer is correct.  However, I am missing the Vendor dimension in it.  How can I work that into your solution?

sunny_talwar

You could have not tried this

Avg(Aggr(Count(DISTINCT  [Driver ID]), Month, Vendor))

cliff_clayman
Creator II
Creator II
Author

I need to specify the value for Vendor.  Vendor = VendorA

sunny_talwar

Use set analysis for that

cliff_clayman
Creator II
Creator II
Author

Yes, that is what I was asking help for a few questions back.

sunny_talwar

All you said was this

Can it be done using Set Analysis?

Anyways... add this {<Vendor = {'Vendor A'}>}