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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count distinct per Date

Hi Guys

This looks like a simple one - but i just cant get around it.

Please see below, i want to able count the distinct number of Agents per Date.

 

DateAgent
01-AprA
01-AprB
02-AprA
02-AprB
02-AprB
03-AprA
03-AprB
03-AprC
03-AprA
03-AprB
03-AprC
03-AprA

So the answer should be:

  

DateCount of Agents
01-Apr2
02-Apr2
03-Apr3

Further to that, if the user selects a month then it counts the distinct number of Agents for that month.

If the user selects a year then it counts the distinct number of Agents for that year.

Hope this makes sense.

Any help would be appreciated.

Regards,

Magen

Labels (1)
12 Replies
robert_mika

Try like this:

Sum(Aggr(count (distinct agents), Date, dim1,dim,2,.....) )

DavidFoster1
Specialist
Specialist

The Aggr statement is used to set the context for the calculation. It looks like you are trying to calculate daily sales per 'head' and then use that in further calculations. In that case you need to include the Sales calculation inside the aggr as well.

TRY:

AVG(AGGR(SUM(SALES)/COUNT(DISTINCT AGENTS),Date))

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this as Mika suggested, you can add additional parameters to Aggr which you are using in your chart

Sum(Aggr(count (distinct agents), Date, dim1,dim,2,.....) )


Regards,

Jagan.