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: 
Not applicable

why is count function in straight table multiplying my records by 5

Hi, I have only 5 records of PO_num '1234' as shown in the table below:

DatePO_numStoreLine CostQtyUnit Cost
30/09/141234A543.6454.36
30/09/141234A543.6654.36
30/09/141234A265.8854.36
30/09/141234A265.8254.36
30/09/141234A1653.2554.36

I want to create a column that displays how many records exists for PO_num '1234'. However, when I use count function in straight table, it multiplies each record by 5 :

PO_numCount (PO_num)
123425

Then I used this straight table to check:

DatePO_numStoreLine CostQtyUnit CostCount(PO_num)
30/09/141234A543.6454.365
30/09/141234A543.6654.365
30/09/141234A265.8854.365
30/09/141234A265.8254.365
30/09/141234A1653.2554.365

How can I achieve this result? :

PO_numCount (PO_num)
12345

Thanks.

8 Replies
ariel_klien
Specialist
Specialist

Hi,

I think that something on your script is multiply the table,

try to load the table with Distinct

or use count(distinct PO_num)  - less recommended

BR

Ariel

maleksafa
Specialist
Specialist

count(Distinct PO_num) will give you 5, you need to check your data model how do you have the PO_num field there and you will be able to find why it is multiplied by 5.

PrashantSangle

Hi,

Take PO_num in list box->Property->General->select Frequency.

See how may frequency you are getting for PO_num

To acheive desired result you have to use AGGR()

try like

count(Aggr(Distinct PO_num),Date,Store)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

same is not happening on my side

check ur script again might be you doing wrong somewhere

mdmukramali
Specialist III
Specialist III

Dear,

for me i'm getting correct.

Not applicable
Author

Thanks so much. But it's actually 'count(Aggr(Distinct PO_num,Date,Store))'. Another thing is I have this table in excel (the duplicated records are supposed to be):

PO_numDateStoreDrUnit PriceValue
34530/09/14A76452347645
34530/09/14A76452347645
34530/09/14A23452342345
34530/09/14A23452342345
34530/09/14A34562343456

But when I created this table box in Qlikview it combines the duplicated records into 1 record:

PO_num2DateStoreDrUnit _PriceValue
34530/09/14A76452347645
34530/09/14A23452342345
34530/09/14A34562343456

I applied the same formula 'count(Aggr(Distinct PO_num2,Date,Store,Dr,Unit_Price,Value))' in a straight table but it counts only 3 records of PO_num2 '345' when it's supposed to be 5. How can I achieve this straight table? :

PO_numCount (PO_num)
3455

Thanks.

PrashantSangle

Hi,

Try it like this,

count(Aggr(Count(Distinct PO_num),Date,Store,Dr,Unit_Price,Value)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Thanks, but I still get

PO_numcount(Aggr(Count(Distinct PO_num),Date,Store,Dr,Unit_Price,Value))
3453