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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Merge update Resident tables

Hello,

Is there any way I could combine three qvds in to a single table?

My first table stores 2009_Sales, Second 2010_Sales and thrid 2011_sales

I want to create a Single table  with all three year sales reported as seperate column with out the account being duplicated

ex. if Account A077 is present in 2009_sales and 2011_sales (not in 2010_sales) I need to create only one record with 2009 & 2011 sales and then put 0 for 2010 . Also I would like to add two columns 1.100_SALE (If there a $100 sale in any of the year value would be Y) and 2.Total (2009_sales+2010_Sales+2011_sales)

Thanks in advance,

A.Paul

2009_SALES_TABLE
AccountContact2009Sales
A001Bill$100
A002Mark$70
A003Steve$25
A004Susie$175
A005James$560

2010_SALES_TABLE
AccountContact2010Sales
A001Bill$230
A002Mark$590
A003Steve$80
A008Jodi$100
A009Job$100
A010Ronnie$20
2011_SALES_TABLE
AccountContact2011Sales
A001Bill$40
A002Mark$200
A009Job$100
A006Elvis$10
A007Mary$5
A004Susie$200

Final_TABLE
AccountContact100_SALE2009Sales2010Sales2011SalesToatlSales
A001BillY$100$230$40$370
A002MarkY$70$590$200$860
A003SteveN$25$80$0$105
A004SusieY$175$0$200$375
A005JamesY$560$0$0$560
A006ElvisN$0$0$10$10
A007MaryN$0$0$5$5
A008JodiY$0$100$0$100
A009JobY$0$100$100$200
A010RonnieN$0$20$0$20
1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Hi Ajipaul,

Thanks very much ok no problem to achieve this you make joins between this tables and load them so no duplicate values comes.

But in qlikview we can achive this type of problem after load also. We have to do in place of Concate use Join command.

Like

T1:

LOAD Account,

     Contact,

     [2009Sales]

FROM

DD.xlsx

(ooxml, embedded labels, table is Sheet1);

Join(T1)

LOAD Account,

     Contact,

     [2010Sales]

FROM

DD.xlsx

(ooxml, embedded labels, table is Sheet2);

Join(T1)

LOAD Account,

     Contact,

     [2011Sales]

FROM

DD.xlsx

(ooxml, embedded labels, header is 1 lines, table is Sheet3);

Let me know about this.

HTH

Rgds

Anand

View solution in original post

13 Replies
its_anandrjs
Champion III
Champion III

Hi,

Yes it is possible to join this qvds you need to concatenate this qvds.

Rgds

Anand

its_anandrjs
Champion III
Champion III

Hi,

Load tables like

T1:

Load

from table1;

concatenate(T1)

Load

from table2;

concatenate(T1)

Load

from table3;

And use isnull( )  function to remove null values like

if(isnull([2010Sales]) = -1,0,[2010Sales])

Rgds

Anand

its_anandrjs
Champion III
Champion III

Hi,

See the attached sample file how to load and use isnull( ) function.

let me know about this.

HTH

Rgds

Anand

its_anandrjs
Champion III
Champion III

Hi,

See the attached sample file how to load and use isnull( ) function.

and compute

to check the 100 sale

If( [2009Sales]+[2010Sales]+[2011Sales] >=100,'Y','N')

HTH

Rgds

Anand

Not applicable
Author

Anand,Thanks for the quick responses

BTW it creates duplicate entries in the table. Is there any way we could eliminate the duplicates?

example: Merge the first three rows in to one?

AccountContact2009Sales2010Sales2011Sales
A001Bill$100.00
A001Bill$230.00
A001Bill$40.00
A002Mark$70.00
A002Mark$590.00
A002Mark$200.00
A003Steve$25.00
A003Steve$80.00
A004Susie$175.00
A004Susie$200.00
A005James$560.00
A006Elvis$10.00
A007Mary$5.00
A008Jodi$100.00
A009Job$100.00
A009Job$100.00
A010Ronnie$20.00
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Perhaps a better way to cahieve this is with joins rather than concatenation. The concat will create those null records. This is how to do it using joins:

temp:

LOAD Account,

     Contact

FROM DD.xlsx (ooxml, embedded labels, table is Sheet1);

Concatenate

LOAD Account,

     Contact

FROM DD.xlsx (ooxml, embedded labels, table is Sheet2);

Concatenate

LOAD Account,

     Contact

FROM DD.xlsx (ooxml, embedded labels, header is 1 lines, table is Sheet3);

DataTable:

NoConcatenate

LOAD Distinct * Resident temp;

DROP Table temp;

Left Join (DataTable)

LOAD Account,

     Contact,

     [2009Sales]

FROM DD.xlsx (ooxml, embedded labels, table is Sheet1);

Left Join (DataTable)

LOAD Account,

     Contact,

     [2010Sales]

FROM DD.xlsx (ooxml, embedded labels, table is Sheet2);

Left Join (DataTable)

LOAD Account,

     Contact

FROM DD.xlsx (ooxml, embedded labels, header is 1 lines, table is Sheet3);

The first loads ensure that the result table contains all possible combinations of account and contact. The subsequent loads "join" the YYYYSales columns to the data table.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
its_anandrjs
Champion III
Champion III

Hi Ajipaul,

Thanks very much ok no problem to achieve this you make joins between this tables and load them so no duplicate values comes.

But in qlikview we can achive this type of problem after load also. We have to do in place of Concate use Join command.

Like

T1:

LOAD Account,

     Contact,

     [2009Sales]

FROM

DD.xlsx

(ooxml, embedded labels, table is Sheet1);

Join(T1)

LOAD Account,

     Contact,

     [2010Sales]

FROM

DD.xlsx

(ooxml, embedded labels, table is Sheet2);

Join(T1)

LOAD Account,

     Contact,

     [2011Sales]

FROM

DD.xlsx

(ooxml, embedded labels, header is 1 lines, table is Sheet3);

Let me know about this.

HTH

Rgds

Anand

its_anandrjs
Champion III
Champion III

Hi,

Hope you got correct answer, If you got correct answer so mark it correct under my post.

Let me know about this.

Rgds

Anand

Not applicable
Author

Thank You Jonathan  & Anand!