Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jengancc
Contributor II
Contributor II

Cant get correct count at aggr level

Hi

This is my data set

   

ChannelBUMonthQty
webCI11
webCI12
webDB13
webDB14
webDB15
webDB16
webDB19
webDB24
webDB22
webDB21
webCI29
webCI28
webCI27

I wanted to get the last col to be a distinct count for the month. which would be 7 for JAN and 6 for FEB.

But you can see from the results I only get 7 for the 1st row, and 6 for the last row.

Not understanding why it is blank for the 2 middle rows.

Can you help to explain what I should do? and why is my logic wrong? Appreciate your inputs.

   

ChannelBUMonthCount(DISTINCT Qty)aggr((Count(  Distinct Qty)) ,Month)
9-
webCI127

web

DB

1

5

-

web

CI

2

3

-

web

DB

2

3

6

The effect I wanted is

   

ChannelBUMonthCount(DISTINCT Qty)aggr((Count(  Distinct Qty)) ,Month)
9-
webCI127
webDB157
webCI236
webDB236

   

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Count(DISTINCT TOTAL <Channel, Month> Qty)

View solution in original post

5 Replies
sunny_talwar

Try this

Count(DISTINCT TOTAL <Channel, Month> Qty)

sunny_talwar

Or this

Aggr(NODISTINCT Count(DISTINCT Qty), Channel, Month)

jengancc
Contributor II
Contributor II
Author

This is great! Thanks Both works.

I understand Count(DISTINCT TOTAL <Channel, Month> Qty).

Can you explain why Aggr(NODISTINCT Count(DISTINCT Qty), Channel, Month) has to use NODISTINCT?

I am counting the number of rows. So I am wondering why NODISTINCT works but not DISTINCT.

Thanks.

sunny_talwar

Before I try to explain this myself, see if one of these two threads answer your question

What NODISTINCT parameter does in AGGR function?

Qlik Tips: No nodistinct

jengancc
Contributor II
Contributor II
Author

Thank you! It definitely helps a lot!