Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Combine two data sources into one table

Hi,

The problem i have at the minute is that i want to combine the Sales which come from a sql database (This Years sales) and they have previous years sales stored in an excel spreadsheet that is in the same format etc with layout and columns....

Is there a way into which i can join all the data into the same table?

Regards

Dan

3 Replies
Not applicable
Author

If the resulting tables have the exact same field names, Qlikview will automatically combine them. If they have any differing field names, you can force concatenation by putting Concatenate before the load statement of the Excel spreadsheet

EDIT: Make sure you place the load statement for the Excel spreadsheet directly after the load statement for the SQL table if you are using the forced concatenation. If not, you need to put the name of the target table for the concatenation after Concatenate in parenthesis. Concatenate (Target)

Not applicable
Author

Here's how to use CONCATENATE, in the simplest case. You can substitute the 2 Inline LOAD statement with the actual SQL and Excel LOAD.

Sales:
LOAD * INLINE [
Product, Customer, Date
P-1, C-1, 2008-11-11
P-2, C-1, 2008-11-12
];
CONCATENATE
LOAD * INLINE [
Product, Customer, Date
P-3, C-1, 2009-10-10
P-4, C-2, 2009-12-02
];

johnw
Champion III

Just for safety, I always follow a policy of explicitly doing CONCATENATE ([My Table]) even when the fields are the same and/or one load immediately follows the other. That way, if I add fields to one of the tables, or insert another load between the two, I don't have to remember or notice that I was relying on the default concatenation, which will now no longer behave correctly and need to be fixed. So I feel safer just being explicit in all cases. Something to consider, anyway.