Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
RubenMoreno
Contributor III
Contributor III

Identify inflow of new lines in a table

Dear all,

I have the following question, you might be able to support.

I load a table once a week in Qlik Sense including new data linked to that week. E.g.

Column 1 / Column 2

ValueA     /  CW02

ValueB    /   CW02

ValueA    /   CW03

ValueC    /   CW03

I want to add a new column "Column 3" when loading the data to identify if the value in "Column 1" has been already provided in a previous week or not. E.g.

Column 1 / Column 2 / Column 3

ValueA      /  CW02         / NEW

ValueB     /   CW02        / NEW

ValueA     /   CW03        / NOT NEW

ValueC    /   CW03         / NEW

As "ValueA" was already in the table in CW02, then when loading the data in CW03, it should be highlighted as NOT NEW in "Column 3" for CW03.

I appreciate if you could support with this. Thanks you in advance.

Best regards,

Ruben

Labels (2)
4 Replies
Taoufiq_Zarra

Hi,

If I understood correctly , maye be :

Data:

load *,if(Exists([Column 1]),'NOT NEW','NEW') as [Column 3] inline [
Column 1 / Column 2

ValueA     /  CW02

ValueB    /   CW02

ValueA    /   CW03

ValueC    /   CW03
](delimiter is '/');

 

output :

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
lironbaram
Partner - Master III
Partner - Master III

HI

this script should help you 

OldData:
load *,
     if(Exists([Column 1]),'Old','New') as [Column 3];
load * inline [
Column 1,Column 2
ValueA,CW02
ValueB,CW02
];

NewData:
Load *,
      if(Exists([Column 1]),'Old','New') as [Column 3];
load * inline [
Column 1,Column 2
ValueA,CW03
ValueC,CW03
];
RubenMoreno
Contributor III
Contributor III
Author

Hello Taoufiq,

I tried your suggestion and my problem is that the code identifies all lines as "Old"

The example I provided is a very simplyfied version of my problem. I will provide further details.

My Qlik Sense App is reading the data from an Excel file that it is weekly updated. Then I execute "Load data" and with this, old and new lines of this excel are re-loaded. The code would look like this:

[Weekly Report]:
LOAD
     [Prog Code],
     [Customer Version],
     ...
     [CW],
     [Key]
FROM [lib://.../Weekly BFE discrepancy monitoring.xlsx]
(ooxml, embedded labels, table is [Weekly Report]);

My objective would be to compare the values in  [Key] for the latest week with the content of  [Key] for previous weeks and identify  if they are "new" or "old".

Thank you in advance.

Best regards,
Rubén

Taoufiq_Zarra

Hello Rubén ,

Can @lironbaram 's solution solve the problem?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉