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: 
venkatesh61524
Contributor II
Contributor II

count distinct function in pivot table

Dear All,

I have a two columns data serial number and delivery number. Now if we choose one serial number have two same delivery numbers and different delivery number.

Example data want to see in Pivot table:(Requirement)

 

Serial NoDelivery NumberTotal
518012
801
518151
609502
950
609901
8015002
1500
8020001

The above example table .if we select 51 serial number can see three delivery numbers. But in three delivery numbers have two are same one is different for same serial number.now we need to show this data into pivot chart.

i have tried with this expression in pivot chart:

Aggr( Count(Distinct [Delivery Number]),[Serial No],[Delivery Number])

After expression have data in pivot table:

 

Serial NoDelivery NumberTotal
518011
8151
609501
9901
8015001
20001

Please suggest and show the correct expression for my requirement ..

1 Solution

Accepted Solutions
sunny_talwar

What about this:

Count(DISTINCT [Delivery Number]

View solution in original post

10 Replies
MK_QSL
MVP
MVP

Aggr( Count([Delivery Number]),[Serial No],[Delivery Number])

or

Aggr(Count(TOTAL <[Serial No]> [Delivery Number]),[Serial No],[Delivery Number])

venkatesh61524
Contributor II
Contributor II
Author

Hi Manish,

Thanks for the quick response...

As suggested, I have applied above expressions.it is not working..

.Total is wrong

now Out put is:

Serial NoDelivery NumberTotal
5180116
81516
6095016
99016
80150016
200016

Expected out put is below:

Serial NoDelivery NumberTotal
518012
801
518151
609502
950
609901
8015002
1500
8020001

Please provide correct expression for expected out put..to match my requirement..

venkatesh61524
Contributor II
Contributor II
Author

Dear All,

Please provide the correct expression to match the requirement

Thanks

sunny_talwar

Do you have Serial No. and Delivery Number as your only two dimensions in the pivot table? What if you just do Count([Delivery Number]) as your expression?

venkatesh61524
Contributor II
Contributor II
Author

In pivot table i have two dimensions only. But outside i have sales document and ,company code, actual delivery date has in multi box selection..But in data model i have many fields and it does booking ,billing, delivery and backlog information in different charts.

But here i am just building one pivot chart for the delivery requirement.

Now the requirement had mentioned in original post.

If i select one sales order . i can see 4- serial numbers and 16 Delivery numbers(12 are same 4 has different delivery numbers).

from there after if i select one serial number from 4. I could see 3 delivery numbers that to 2 are same and one has different .

Example of Input Data for Pivot chat:

Serial NoDelivery Number
51801
51801
60801
60801
80801
80801
90801
90801
51666
60666
80666
90666

Expected out put for Pivot chart:

Serial NoDelivery NumberTotal
518012
516661
608012
606661
808012
806661
908012
906661

@sunny T

As per your suggestion. i have used - count(Delivery number) on  above example input data.

i could see  wrong output as:

Serial NoDelivery NumberTotal
5180112
516664
6080112
606664
8080112
806664
9080112
906664

Please suggest and let me know suitable expression for example input data for pivot chart

sunny_talwar

Can you share a qvw sample?

sunny_talwar

What about this:

Count(DISTINCT [Delivery Number]

Anonymous
Not applicable

count_null.JPG

I think in yur data source, the row below repeat serial No is being interpreted as null values by Qlik. Convert it to populated values and a simple count (delivery number) function should work

venkatesh61524
Contributor II
Contributor II
Author

Thank you all , now issue has been resolved.

I have a actual delivery date information in data model.so I have added to pivot table and applied expression as Count(DISTINCT [actual delivery date]).