Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problems with different databases

Hi!

I have two different data bases: one database (old database) contains data until december of my processes.

The other database (new database) contains data from december to now.

To achieve my kpis this year, y need fields from new database, but if i need to compare with the same kpis in the last year, i need to find the fields in the old database....

For example:

OLDBBDD:

Table A      Table B     Table C

Field 1     Field 1          Date

Field 2      Field 2          Field1

NEWBBDD:

Table A     Table B     Table C

Field 11     Field 12          Date2

Field 21      Field 23         Field12

Both BBDD have different fields, so to calculate one kpi this year i have to use TableA.Field1 and TableC.Date1 and to calculate THE SAME KPI the last year i have to use TableA.Field11 and TableC.Date2.

Do you know the process I must follow to get done comparing the KPI?

Thanks a lot.

4 Replies
Gysbert_Wassenaar

Rename the fields from the new database during the script execution so they have the same name as they had in the old database.

CONNECT ...old_db...;

TableA:

SELECT Field1, Field2, 'OldDB' as Source FROM .... ;

DISCONNECT;

CONNECT ...new_db...;

SELECT Field11 as Field1, Field21 as Field2, 'NewDB' as Source FROM .... ;


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

when you load the data in Qlik from the 2 db rename the fields and concatenate;

example for table A

Table:

load

    [Field 1] as Field1,

    ..........,

    'OLDDB' as Db

    ;

SQL

    Select * from tableAinolddb;

concatenate (Table)

load

    [Field 11] as Field1,

    ..........,

    'NEWDB' as Db

    ;

SQL

    Select * from tableAinolddb;


then use set analysis to compare this year to previous year


effinty2112
Master
Master

Hi Paula,

                    The databases' field names may have changed but if their meanings are the same then why not concatenate?:

Along these lines:

Table A:

Load

Field 1,

Field 2

From OLDBBDD;

Concatenate(Table A)

Load

Field 11 as Field 1,

Field 12 as Field 2

From OLDBBDD;

Good luck

Andrew

chrisg
Partner - Creator III
Partner - Creator III

Hi Paula,

try to load the data of the first DB

with:

Load

     Field1;

     Filed2

From Table A;

and the second with

Concatenate Load

     Field 11 AS Field1;

     Field 1" AS Field"

From

the result is one table with all the data from Tabel A (old and new)

Hope that helps

Christoph

Do or Do Not. There is no try!