Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

load a record twice

Hi Folks,

normally one record is one record.

However, new development brings up the question how I can load a record twice,

say key: Record1 and Record1a where I have to calculate the turnover twice but the profit once, split into

Record1 for 50% and Record1a also for 50%.

I would LOAD the Record1 and double it, naming the double Record1a.

Any idea on the optimal loading and script technique?

Thank you so much, happy to work together in this community.

Wolfgang

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe this could be an alternative:

LOAD Key & If(Iterno() = 2,'a','') as Key,

         Profit / 2 as Profit,

          Turnover

FROM ....

WHILE iterno() <=2;

View solution in original post

5 Replies
sunny_talwar

May be something like this:

Table:

LOAD FieldName

FROM Source;

Concatenate (Table)

LOAD FieldName & 'a' as FieldName

FROM Source;

swuehl
MVP
MVP

Maybe this could be an alternative:

LOAD Key & If(Iterno() = 2,'a','') as Key,

         Profit / 2 as Profit,

          Turnover

FROM ....

WHILE iterno() <=2;

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Maybe by using a WHILE clause? The following doubles all rows:

:

SplitProfitTable:

NOCONCATENATE

LOAD RecordID & pick(IterNo(), '', 'a') AS RecordID,

     Revenue,

     Profit * 0.5 AS Profit

RESIDENT OriginalTable

WHILE IterNo() <= 2;

martinpohl
Partner - Master
Partner - Master

So do this:

Temp:

load

RecordNo,

Turnover

from Source;

left join load

RecordNo,

count(RecordNo) as Counter

resident Temp;

left join (Temp) load

RecordNo,

Profit

from Source;

Final:

load

RecordNo,

Turnover,

Profit/Counter as Profit

resident Temp;

drop table Temp;

Regards

Anonymous
Not applicable
Author

Danke.

Damit komme ich weiter. Peter hat auch diesen Weg beschrieben.

Wolfgang