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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Table reduction using distinct- help?

Hi,

I am pretty sure I am doing something incorrectly in script here but can't work out what. I am trying to do a resident load from one table, summing values from a previous table.

I want to change this:

CustomerIDProductMonthC1C2C3C4C5
A1jan.091000000
A1jan.090200000
A1jan.090030000




into this:

CustomerIDProductMonthC1C2C3C4C5
A1jan.0910020030000


The code I am using is:







BUSINESSNEW4:

LOAD

DISTINCT

CUSTOMERID

,

PRODUCT,

MONTH,

SUM(C1) AS C1,

SUM

(C2) AS C2,

SUM

(C3) AS C3,

SUM

(C4) AS C4,

SUM

(C5) AS C5

RESIDENT

GROUP

DROP

TABLE

BUSINESSNEW3;

BY CUSTOMERID, PRODUCT, MONTH;BUSINESSNEW3



The script execution progress states the following:

BUSINESSNEW3 << BUSINESSNEW2 37,596 lines fetched

BUSINESSNEW3 << BUSINESSNEW3 73,343 lines fetched

It is almost doubling the number of lines and not recognising the name BUSINESSNEW4.

I can't see where the problem is. Any ideas?

Thanks





1 Solution

Accepted Solutions
Not applicable
Author

Hi,

here are an working example of your data. Hope it helps to find out the difference.

Merry Christmas!

Rainer

View solution in original post

4 Replies
Not applicable
Author

Hi,

here are an working example of your data. Hope it helps to find out the difference.

Merry Christmas!

Rainer

vidyut
Partner - Creator II
Partner - Creator II

Add one more field

Select 1 as TmpID, .....

In the New Table, and Load again. Should work.

Not applicable
Author

Thanks Rainer.

I did not realise that you can not give a calculated field the same name as the field it is calculating from, but your example works great!

Merry Christmas to you too.

R

Not applicable
Author

Vidyut, same reply to you. Your solution works as well.

Many thanks for your help.

R