Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
WEBINAR June 25, 2025: Build on Apache Iceberg with Qlik Open Lakehouse - REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need help with joining two tables

Hey everybody!

I need to join these two tables:

first table is a table of ids, types of expense and ammount for every pay date...

Date
IDExpense TypeExpense Ammount
01/02/20151Car100
01/03/20151Parking200

second table is a range of all the dates from min to max in the first table:

Date
01/02/2015
02/02/2015
03/02/2015

I want to join them so that every ID+Type pair would be paired with every date in the second table with only ammount in the new dates left blank (and later i would propagate them...)

After the join I would like to be able to order the new table like this:

DateIDExpense TypeExpense Ammount
01/01/20151Car100
02/01/20151Car-
03/01/20151Car-
01/01/20151Parking200
02/01/20151Parking-
03/01/20151Parking-

So that in the script i can create a running total for each category...

How should i go about this?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

T1:

LOAD Date,

    ID,

    [Expense Type],

    [Expense Ammount]

FROM

[https://community.qlik.com/thread/199407]

(html, codepage is 1252, embedded labels, table is @1);

T2:

LOAD Date

FROM

[https://community.qlik.com/thread/199407]

(html, codepage is 1252, embedded labels, table is @2);

JOIN (T2) LOAD DISTINCT ID, [Expense Type] RESIDENT T1;

Left JOIN (T2) LOAD * RESIDENT T1;

RESULT:

NOCONCATENATE LOAD Date, ID,  [Expense Type], [Expense Ammount]

RESIDENT T2

ORDER BY ID, [Expense Type], Date;

DROP TABLES T1, T2;

Note that this won't fully replicate your third table, since your second table does not show the full range of dates of the first table. I assume this is a typo / error in your post.

View solution in original post

3 Replies
swuehl
MVP
MVP

Maybe like

T1:

LOAD Date,

    ID,

    [Expense Type],

    [Expense Ammount]

FROM

[https://community.qlik.com/thread/199407]

(html, codepage is 1252, embedded labels, table is @1);

T2:

LOAD Date

FROM

[https://community.qlik.com/thread/199407]

(html, codepage is 1252, embedded labels, table is @2);

JOIN (T2) LOAD DISTINCT ID, [Expense Type] RESIDENT T1;

Left JOIN (T2) LOAD * RESIDENT T1;

RESULT:

NOCONCATENATE LOAD Date, ID,  [Expense Type], [Expense Ammount]

RESIDENT T2

ORDER BY ID, [Expense Type], Date;

DROP TABLES T1, T2;

Note that this won't fully replicate your third table, since your second table does not show the full range of dates of the first table. I assume this is a typo / error in your post.

Not applicable
Author

First thing first, thank you so much! I was really starting to lose hope...

Any chance you can explain what you did there? It's working perfect but im still not sure i understand...

swuehl
MVP
MVP

Well, I just followed your recipe:

"I want to join them so that every ID+Type pair would be paired with every date in the second table with only ammount in the new dates left blank (and later i would propagate them...)"


  1. JOIN (T2) LOAD DISTINCT ID, [Expense Type] RESIDENT T1; 
  2.  
  3.  
  4. Left JOIN (T2) LOAD * RESIDENT T1; 
  5.  

After the join I would like to be able to order the new table like this"


  1. RESULT: 
  2. NOCONCATENATE LOAD Date, ID,  [Expense Type], [Expense Ammount] 
  3. RESIDENT T2 
  4. ORDER BY ID, [Expense Type], Date