Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to be able to build a fact table in Qlik Sense, where I collect data from different data sources. When fetching data from the data sources I want to limit the queries to the base structure of my fact table to limit data to a minimum.
Example:
Base structure of fact table
user_id | name |
---|---|
scjo | Scarlett Johansen |
brpi | Brad Pitt |
toha | Tom Hanks |
anjo | Angelina Jolie |
mada | Matt Damon |
Sales table
user_id | sales |
---|---|
scjo | 553 |
toha | 625 |
anjo | 125 |
brpi | 485 |
Budget table
user_id | budget |
---|---|
scjo | 500 |
brpi | 700 |
toha | 300 |
anjo | 150 |
mada | 250 |
Sales meetings table
user_id | meeting_date |
---|---|
brpi | 2017-01-20 |
brpi | 2017-02-03 |
toha | 2017-03-10 |
anjo | 2017-03-22 |
The source tables will in reality contain a lot of data on other user_ids, so I need to filter on only the employees in my fact table.
How to do this?
Hope you guys can help.
For Example try below
FACT
LOAD * inline [
user_id | name |
---|---|
anjo | Angelina Jolie |
brpi | Brad Pitt |
mada | Matt Damon |
scjo | Scarlett Johansen |
toha | Tom Hanks |
];
INNER KEEP
table2
load * inline [
user_id |
---|
anjo |
brpi |
mada |
scjo |
toha |
];
Drop table table2;
after this you will only have FACT data for ID's specified in table2
I think KEEP is what will help you in this scenario
Look at the example on using keep here
Understanding Join, Keep and Concatenate
For Example try below
FACT
LOAD * inline [
user_id | name |
---|---|
anjo | Angelina Jolie |
brpi | Brad Pitt |
mada | Matt Damon |
scjo | Scarlett Johansen |
toha | Tom Hanks |
];
INNER KEEP
table2
load * inline [
user_id |
---|
anjo |
brpi |
mada |
scjo |
toha |
];
Drop table table2;
after this you will only have FACT data for ID's specified in table2