Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys, I am new to Qlikview and I am having some troubles while trying to load data from multiple fact tables. My scenario is as following:
I need to get information from 4 different fact tables, they share the same dimensions, I´ve tried to use CONCATENATE but it is duplicating the values of my metrics. Any ideas?
Thanks in advance for your support.
I normally use a hardcoded "source" field when joining fact tables, then you can use that as part of your set analysis
Table1:
load
*,
'Table1' as Source
from ....
;
Table2:
load
*,
'Table2' as Source
from ....
;
in the front end change the expression to a set analysis
COUNT( distinct {<Source ={'Table1'} >}CourseKey)
that way you can separate each fact
Could you describe your fields and tables?
Make sure you are not declaring new table names.
Check the internal table view(Ctrl+T on a desktop client or IE plugin version) to make sure all 4 FACTs are indeed concatenated into a single table.
Code should be like this:
TableName:
LOAD ..
...
..
from source1;
concatenate
LOAD ...
...
..
...
...
from source 2;
...
...
..
If you happen to include any other loads in between - try using concatenate(TableName)
Hi Clark,
Try using qualify and unqualify function which will add the table names in front of your field names for all the four tables leaving out your Primary key.
For eg:
Qualify *;
Unqualify PRODUCT_KEY;
SalesTable:
Load
PRODUCT_KEY,
FIXED_COST,
VARIABLE_COST,
TOTAL_COST
From Sales.qvd
;
CostTable:
Load
PRODUCT_KEY,
FIXED_COST,
VARIABLE_COST,
TOTAL_COST
From Cost.qvd
;
Unqualify *;
Hope this helps.
Many Thanks
Karthik
Thanks everyone for your quick responses.
The Concatenate has worked for me partially, because I need a DISTINCT Count of a column, so when I concatenate my tables, I use the DISTINCT Count just to remove the duplicates from the concatenation, but not the duplicate values in the column, so what I basically need is something as follows: COUNT(DISTINCT(COUNT(DISTINCT CourseKey) --- I know this syntax has not much sense but I can't figure out a way of getting my Distinct values.
I normally use a hardcoded "source" field when joining fact tables, then you can use that as part of your set analysis
Table1:
load
*,
'Table1' as Source
from ....
;
Table2:
load
*,
'Table2' as Source
from ....
;
in the front end change the expression to a set analysis
COUNT( distinct {<Source ={'Table1'} >}CourseKey)
that way you can separate each fact
It works perfectly Ramon! Just confirming what it is doing internally... By using the set analysis I am specifying that I want Qlikview to make the Distinct Count from the information in <Source={'Table1'} table only right?
Thank you very much
correct, that is how QV is handing it