Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ananyaghosh
Creator III
Creator III

Load extra one collumn in preceeding load - Preceeding load problem

Hi,

I have using the following code and 'ChnlCode' column is loaded along with two other columns and I only expect it will only contain two column: [%Territory Key],Flag

[BC]:
Load
[%Territory Key],
if (ChnlCode=6,'DCIO',if(Match(ChnlCode,'1', '11', '12', '2'),'BC')) as Flag;

Load [%Territory Key],
[Channel Code] as ChnlCode,
[Wholesaler Full Name]
Resident [Dim Territory];

left Join
Load [Channel Code] as ChnlCode
Resident [Dim Channel]
where match([Channel Code],'1', '11', '12', '2','6');

Please suggest what is wrong here?

9 Replies
Anil_Babu_Samineni

May be use this?

[BC]:
Load
[%Territory Key],
if (ChnlCode=6,'DCIO',if(Match(ChnlCode,'1', '11', '12', '2'),'BC')) as Flag;

Load [%Territory Key],
[Channel Code] as ChnlCode,
[Wholesaler Full Name]
Resident [Dim Territory];

[Dim]:

Load [Channel Code] as ChnlCode

Resident [Dim Channel]

left Join ([BC])
Load ChnlCode
Resident [Dim]
where match(ChnlCode,'1', '11', '12', '2','6');

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vinieme12
Champion III
Champion III

can you explain clearly what is your current output and the expected output?

Are you getting any error messages?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

Where are you Left Joining this into? BC? But BC doesn't even have ChnlCode anymore?

left Join

Load [Channel Code] as ChnlCode

Resident [Dim Channel]

where match([Channel Code],'1', '11', '12', '2','6');

vinieme12
Champion III
Champion III

You are basically creating a Cartesian Join

BC                                                  Left  JOIN                  table2

[%Territory Key]                                                                    ChnlCode

Flag                               



So each row of BC will be joined with each row of table2



[BC]:
Load
[%Territory Key],
if (ChnlCode=6,'DCIO',if(Match(ChnlCode,'1', '11', '12', '2'),'BC')) as Flag;

Load [%Territory Key],
[Channel Code] as ChnlCode,
[Wholesaler Full Name]
Resident [Dim Territory];

left Join
Load [Channel Code] as ChnlCode
Resident [Dim Channel]
where match([Channel Code],'1', '11', '12', '2','6');

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ananyaghosh
Creator III
Creator III
Author

hi,

Basically I want to join 'Dim Territory' table with [Dim Channel] , based on [Channel Code] column and want to load

[%Territory Key],Flag columns only for whole set of data.

So I am using:

[BC]:
Load
[%Territory Key],
if([Channel Code]=6,'DCIO',if(Match([Channel Code],'1', '11', '12', '2'),'BC')) as Flag;
Load [%Territory Key],
[Channel Code],
[Wholesaler Full Name]
Resident [Dim Territory];

left Join
Load
if([Channel Code]=6,'DCIO',if(Match([Channel Code],'1', '11', '12', '2'),'BC')) as Flag;
Load [Channel Code]
Resident [Dim Channel];

code. But when I choose [Channel Code] as filter from the drop down, wring result is showing.

vinieme12
Champion III
Champion III

sorry buddy you post still doesn't give any clarity on what you are trying to do with the JOIN

Can you post a sample

Preparing examples for Upload - Reduction and Data Scrambling

Qlik Community Tip: How to Get Answers to Your Post

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

100% agree with Vineeth... no idea what you are doing and what is going wrong when you select Channel Code

ananyaghosh
Creator III
Creator III
Author

Hi,

I am using the following code to join two tables:  'Dim Territory' table with [Dim Channel] , based on [Channel Code] column and want to load only [%Territory Key] and FLAG column in the BC table, as I only use two columns in the preceding load. But when I load the data it loads three columns: [%Territory Key] , FLAG and  [Channel Code] in the BC table.

So how can I overcome this situation? means how to only load two column?

[BC]:
Load
[%Territory Key],
if([Channel Code]=6,'DCIO',if(Match([Channel Code],'1', '11', '12', '2'),'BC')) as Flag;
Load
[Channel Code],
[Wholesaler Full Name]
Resident [Dim Territory];

left Join
Load [Channel Code]
Resident [Dim Channel];

vinieme12
Champion III
Champion III

'Dim Territory' table with [Dim Channel] , based on [Channel Code]


Assuming you only want to keep those [%Territory Key] which exist in field [Channel Code]

You should be using RIGHT KEEP instead of Left JOIN!!


try below


[BC]:
Load
[%Territory Key],
if([Channel Code]=6,'DCIO',if(Match([Channel Code],'1', '11', '12', '2'),'BC')) as Flag;
Load
[Channel Code],
[Wholesaler Full Name]
Resident [Dim Territory];

RIGHT KEEP

temp:
Load [Channel Code] as [%Territory Key],
Resident [Dim Channel];

Drop table temp;



Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.