Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
wolfgangmohr
Contributor III
Contributor III

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;

View solution in original post

Peter_Cammaert
Partner
Partner

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
Partner

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

wolfgangmohr
Contributor III
Contributor III
Author

Danke.

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

Wolfgang