Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

merge records of a table

Hi all,
I need help. I have this table loaded in the scrip, where in each date for each IDPv and relative Product, there are four price.
DateIDPvProductPriceCFPriceCSPriceSFPriceST
12/04/2012114591,04
12/04/2012114592,06
12/04/2012114591,24
12/04/2012114592,19
12/04/2012226591,45
12/04/2012226591,67
12/04/2012226591,98
12/04/2012226592,44
13/04/2012114552,33
13/04/2012114551,62
13/04/201211455
13/04/2012114551,41
I want to merge the rows of the same IDPv with the same Product in only a row to obtain this result table:
DateIDPvProductPriceCFPriceCSPriceSFPriceST
12/04/2012114591,042,061,242,19
12/04/2012226591,451,671,982,44
13/04/2012114552,331,621,41
Thanks you in advance!
1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

By using the following script, you can get the table Data which gives the result you want.

Temp:

LOAD * Inline [

Date,IDPv,Product,PriceCF,PriceCS,PriceSF,PriceST

12/04/2012,1145,9,1.04,,,

12/04/2012,1145,9,,2.06,,

12/04/2012,1145,9,,,1,24,

12/04/2012,1145,9,,,,2.19

12/04/2012,2265,9,1.45,,,

12/04/2012,2265,9,,1.67,,

12/04/2012,2265,9,,,1.98,

12/04/2012,2265,9,,,,2.44

13/04/2012,1145,5,2.33,,,

13/04/2012,1145,5,,1.62,,

13/04/2012,1145,5,,,,

13/04/2012,1145,5,,,,1.41

];

Data:

NoConcatenate LOAD Date, IDPv, Product, Sum(PriceCF) as SPriceCF, Sum(PriceCS) as SPriceCS, Sum(PriceSF) as SPriceSF, Sum(PriceST) as SPriceST Resident Temp Group By Date, IDPv, Product;

Drop Table Temp;

View solution in original post

3 Replies
Not applicable

May be this will help. Add script to suppress null values.

Kiran Rokkam.

nagaiank
Specialist III
Specialist III

By using the following script, you can get the table Data which gives the result you want.

Temp:

LOAD * Inline [

Date,IDPv,Product,PriceCF,PriceCS,PriceSF,PriceST

12/04/2012,1145,9,1.04,,,

12/04/2012,1145,9,,2.06,,

12/04/2012,1145,9,,,1,24,

12/04/2012,1145,9,,,,2.19

12/04/2012,2265,9,1.45,,,

12/04/2012,2265,9,,1.67,,

12/04/2012,2265,9,,,1.98,

12/04/2012,2265,9,,,,2.44

13/04/2012,1145,5,2.33,,,

13/04/2012,1145,5,,1.62,,

13/04/2012,1145,5,,,,

13/04/2012,1145,5,,,,1.41

];

Data:

NoConcatenate LOAD Date, IDPv, Product, Sum(PriceCF) as SPriceCF, Sum(PriceCS) as SPriceCS, Sum(PriceSF) as SPriceSF, Sum(PriceST) as SPriceST Resident Temp Group By Date, IDPv, Product;

Drop Table Temp;

View solution in original post

Not applicable

Thank!