Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm pretty new to Qlik Sense and would like some help with the data load editor, specifically on how to perform an Inner Keep. Unfortunately, hours of searching the web for specific examples of doing an inner join only revealed the same simple two table "joins" where the Keep statement always followed the loading of the first table. My situation is more complicated as I would like to only keep records that are in the tables labeled [ERLINKIDS], [Employer-Level Data], and in either [ONE], [TWO], or [THR]. Note: [ONE], [TWO], and [THR] contain subsets of a 1.5M record file that was too big to load in an Excel or .csv file. (BTW, I don't know why Qlik added the following code at the end: RENAME TABLE [ONE] TO [ONE-TWO];. First, I don't know it's purpose. Second, why wasn't it named something like [ONE-THR]? If anyone can answer these questions, I'd appreciate it.)
Here is my code:
[ERLINKIDS]:
LOAD [ACTIVE],
[MCP],
[MCPNAME],
[LINKNAME] AS [ERLINKIDS.LINKNAME],
[SOURCE],
[ERLINKID],
[CITY],
[ST],
[DIV],
[SIC4],
[KEEP],
[LSTATE],
[TYPE],
[LEAID],
[K12EMPL],
[LEAID2],
[K12EMPL2],
[DUNS],
[BUSNAME],
[SECNAME],
[EEsTotal],
[EesHere],
[SIC4DB],
[GOVTIDNUM],
[GovtType],
[GovtDescription],
[County],
[DataFuncCD],
[FTEes],
[PTEes],
[FTEs],
[DataYr],
[LINKNAME]&[ERLINKID] AS [ERLINKIDS.LINKNAME-ERLINKID-Employer-Level Data.LINKNAME-Employer-Level Data.ERLINKID]
FROM [lib://Qlik Stuff/ERLINKIDS.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
where [ACTIVE] = 1 and ([DIV]='ESD' or [DIV]='GSD') and ([NICHENL]='AUTO' OR [NICHENL]='EDUC' OR [NICHENL]='MUNICO'
OR [NICHENL]='HEALTH' OR [NICHENL]='HLTOTH' OR [NICHENL]='HLTSNF' OR [NICHENL]='UNICOL' OR [NICHENL]='OTHER');
[EERanges]:
Load * Inline [EERanges, MinLimit, MaxLimit
N/A, ., 0
1-25, 1, 25
26-50, 26, 50
51-100, 51, 100
101-250, 101, 250
251-500, 251, 500,
501-1000, 501, 1000
1001-2500, 1001, 2500
2501-5000, 2501, 5000
5001-10000, 5001, 10000
Over 10000, 10001, 1000000];
[Employer-Level Data]:
LOAD [LINKNAME] AS [Employer-Level Data.LINKNAME],
[ERLINKID] AS [Employer-Level Data.ERLINKID],
[ZIP] AS [Zip],
[PUBLIC],
[NICHENL],
[SCHDIST],
[NONSCH],
[TOTALEES],
[STATUS] AS [Employer Status],
[LINKNAME]&[ERLINKID] AS [ERLINKIDS.LINKNAME-ERLINKID-Employer-Level Data.LINKNAME-Employer-Level Data.ERLINKID]
FROM [lib://Qlik Stuff/Employer-Level Data.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
where ([NICHENL]='AUTO' OR [NICHENL]='EDUC' OR [NICHENL]='MUNICO'
OR [NICHENL]='HEALTH' OR [NICHENL]='HLTOTH' OR [NICHENL]='HLTSNF' OR [NICHENL]='UNICOL' OR [NICHENL]='OTHER')
AND [STATUS] = 'A' AND [TOTALEES] > 0;
Left Join([Employer-Level Data]) IntervalMatch (TOTALEES) LOAD MinLimit, MaxLimit Resident EERanges;
Left Join([Employer-Level Data])
Load MinLimit, MaxLimit, EERanges Resident EERanges;
DROP table EERanges;
[CUSTMCH]:
LOAD [MCH_NAME] as [MCH Name],
[MCH]
FROM [lib://Qlik Stuff/CUSTMCH.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
[ONE]:
LOAD [MCP],
[MCH],
[ACCT],
[PRODCODE],
[DTYPE],
[KIND],
[SERIES],
[POLS],
[NBILL]
FROM [lib://Qlik Stuff/PRODPART_ACCTS1.xlsx]
(ooxml, embedded labels, table is ONE);
[TWO]:
LOAD [MCP],
[MCH],
[ACCT],
[PRODCODE],
[DTYPE],
[KIND],
[SERIES],
[POLS],
[NBILL]
FROM [lib://Qlik Stuff/PRODPART_ACCTS2.xlsx]
(ooxml, embedded labels, table is TWO);
[THR]:
LOAD [MCP],
[MCH],
[ACCT],
[PRODCODE],
[DTYPE],
[KIND],
[SERIES],
[POLS],
[NBILL]
FROM [lib://Qlik Stuff/PRODPART_ACCTS3.xlsx]
(ooxml, embedded labels, table is THR);
[zipcode]:
LOAD [ZipNumber],
[ZipText] AS [Zip],
[Latitude],
[Longitude],
GeoMakePoint(Latitude,Longitude) as ZipLocation
FROM [lib://Qlik Stuff/Zip Codes.xlsx]
(ooxml, embedded labels, table is zipcode);
[ST to STATE]:
Load [State],
[ST]
FROM [lib://Qlik Stuff/ST to STATE.xlsx]
(ooxml, embedded labels, table is Sheet1);
[cb_2014_us_state_500k/cb_2014_us_state_500k]:
LOAD [US State Boundaries.Name] as [State],
[US State Boundaries.Point],
[US State Boundaries.Area]
FROM [lib://Qlik Stuff/US State Boundaries.kml]
(kml, Table is [cb_2014_us_state_500k/cb_2014_us_state_500k]);
RENAME TABLE [ONE] TO [ONE-TWO];
Thanks,
Bryan
Hi Bryan,
Just by looking at this code it looks like some sort of autogenerated code from "bubbles" in QlikSense. If you are saying you are newbe to QlikSense i doubth you would be able to create this logic ith joins and IntervalMatch.
I know bubbles are a "briliant" feature but they just make a mess when you need to design something more complex than simple relationship.
Would you be able to attach those files (maybe reduce data) so we could work of it and just in few words explain how you would like to link those tables.
This code above is not a usual way developers write code. It is autogenerated with some algorithm.
We would be able to help more when having some data so then Left / Right / Inner Keep or Join examples could be presented to you.
regards
Lech
I think you need to load using the following strategy:
Load ONE
CONCATENATE Load TWO
CONCATENATE Load THREE
INNER KEEP Load ERLINKIDS
Load EERanges
Load Employer-Level Data
Interval match
Load other tables
Hi, Jonathan,
I tried your suggestion but I’m afraid it didn’t produce the desired results. (The code is below just in case I didn't do it as you meant me to do it.) Please let me know if you have another suggestion.
Thanks,
Bryan
[ONE]:
LOAD [MCP],
[MCH],
[ACCT],
...,
[NBILL]
FROM [lib://Qlik Stuff/PRODPART_ACCTS1.xlsx]
(ooxml, embedded labels, table is ONE);
[TWO]:
concatenate LOAD [MCP],
[MCH],
[ACCT],
...,
[NBILL]
FROM [lib://Qlik Stuff/PRODPART_ACCTS2.xlsx]
(ooxml, embedded labels, table is TWO);
[THR]:
concatenate LOAD [MCP],
[MCH],
[ACCT],
...,
[NBILL]
FROM [lib://Qlik Stuff/PRODPART_ACCTS3.xlsx]
(ooxml, embedded labels, table is THR);
[ERLINKIDS]:
inner keep LOAD [ACTIVE],
[MCP],
[LINKNAME] AS [ERLINKIDS.LINKNAME],
[SOURCE],
[ERLINKID],
...,
[LINKNAME]&[ERLINKID] AS [ERLINKIDS.LINKNAME-ERLINKID-Employer-Level Data.LINKNAME-Employer-Level Data.ERLINKID]
FROM [lib://Qlik Stuff/ERLINKIDS.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
where [ACTIVE] = 1 and ([DIV]='ESD' or [DIV]='GSD') and ([NICHENL]='AUTO' OR [NICHENL]='EDUC' OR [NICHENL]='MUNICO'
OR [NICHENL]='HEALTH' OR [NICHENL]='HLTOTH' OR [NICHENL]='HLTSNF' OR [NICHENL]='UNICOL' OR [NICHENL]='OTHER');
[EERanges]:
Load * Inline [EERanges, MinLimit, MaxLimit
N/A, ., 0
1-25, 1, 25
26-50, 26, 50
51-100, 51, 100
101-250, 101, 250
251-500, 251, 500,
501-1000, 501, 1000
1001-2500, 1001, 2500
2501-5000, 2501, 5000
5001-10000, 5001, 10000
Over 10000, 10001, 1000000];
[Employer-Level Data]:
LOAD [LINKNAME] AS [Employer-Level Data.LINKNAME],
[ERLINKID] AS [Employer-Level Data.ERLINKID],
[TOTALEES],
[STATUS] AS [Employer Status],
[LINKNAME]&[ERLINKID] AS [ERLINKIDS.LINKNAME-ERLINKID-Employer-Level Data.LINKNAME-Employer-Level Data.ERLINKID]
FROM [lib://Qlik Stuff/Employer-Level Data.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
where ([NICHENL]='AUTO' OR [NICHENL]='EDUC' OR [NICHENL]='MUNICO'
OR [NICHENL]='HEALTH' OR [NICHENL]='HLTOTH' OR [NICHENL]='HLTSNF' OR [NICHENL]='UNICOL' OR [NICHENL]='OTHER')
AND [STATUS] = 'A' AND [TOTALEES] > 0;
Left Join([Employer-Level Data]) IntervalMatch (TOTALEES) LOAD MinLimit, MaxLimit Resident EERanges;
Left Join([Employer-Level Data])
Load MinLimit, MaxLimit, EERanges Resident EERanges;
DROP table EERanges;
[CUSTMCH]:
LOAD [MCH_NAME] as [MCH Name],
[MCH]
FROM [lib://Qlik Stuff/CUSTMCH.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
[zipcode]:
LOAD [ZipNumber],
[ZipText] AS [Zip],
[Latitude],
[Longitude],
GeoMakePoint(Latitude,Longitude) as ZipLocation
FROM [lib://Qlik Stuff/Zip Codes.xlsx]
(ooxml, embedded labels, table is zipcode);
[ST to STATE]:
Load [State],
[ST]
FROM [lib://Qlik Stuff/ST to STATE.xlsx]
(ooxml, embedded labels, table is Sheet1);
[cb_2014_us_state_500k/cb_2014_us_state_500k]:
LOAD [US State Boundaries.Name] as [State],
[US State Boundaries.Point],
[US State Boundaries.Area]
FROM [lib://Qlik Stuff/US State Boundaries.kml]
(kml, Table is [cb_2014_us_state_500k/cb_2014_us_state_500k]);
RENAME TABLE [ONE] TO [ONE-TWO];
Hi, Lech,
How would I upload subsets of the data files for my app?
In the meantime, assuming we can do this without the sample data, I want to:
Thanks,
Bryan
P.S. I don't know why Qlik added this code: RENAME TABLE [ONE] TO [ONE-TWO];. What is its purpose, and why wasn't it named something like [ONE-THR]?
Hi
I just thought you could reduce your XLSX files to few rows (1000-1000 rows aprox.). Ultimetly you could prefix your Load statements in script with "First 1000" or first "10000" which would run reduced load on your data.
When designing data model for Qlik application i always try to understand how users will interact with filters and objects and what business questions they will try to find an answer for.
Therefore i have suggested to attach your files to this topic so we can play little bit with it.
Another thing is to answer following questions:
Few answers to your questions:
Table1:
Load
KeyFieldXX,
Other fields...
From
...
and then you can load other tables using function "Left keep"
Left Keep (Table1)
Load
KeyFieldXX,
Other fields...
From
...
To get a full picture what are you trying to achieve we need a bit more of your input. Not only technical but also business POW and conceptual POW.
thanks
Lech