Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Mark first instance of Value during Load

Hi

I am loading in a data file that contains a receipt number.  This number is duplicated against multiple lines.  To try to speed up calculations i am looking to populate a new column during the load with a 1 on the first instance of a new receipt number and a 0 on all duplicate lines.

I know I can do this via count(distinct in expressions but want to leverage to speed of sum by utilising 1 and 0 's.

Many thanks

Mark

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

LOAD

ReceiptNr,

if( exists(ReceiptNr),0,1) as FirstOccurrence,

...

FROM ...;

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe like

LOAD

ReceiptNr,

if( exists(ReceiptNr),0,1) as FirstOccurrence,

...

FROM ...;

Not applicable
Author

Hi Mark,

Your load script should look something like:

TempTable:

LOAD If(exists([Recept ID]),0,1),

     ID,

     [Recept ID],

     Amount

FROM

[Sample.xlsx]

(ooxml, embedded labels, table is Sheet1);

This will hopefully produce a table as you desire

Cheers,

Ravi