Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

Generate new records from existing records

I have a table like:

ItemCompAmount
1A11
1B4

Now I want one more record for all comp (A,B here) which is a calculated one (say Item ->Calc3) like

Calc3 = Item->1*2

So out put should be like:

ItemCompAmount
1A11
Calc3A11*2=22
1B4
Calc3B4*2=8

Note: In real scenario, there would be many more items and comps

Please help.

8 Replies

Re: Generate new records from existing records

Try this,

     Data:

          Load Item,Comp,Amount

          From xyz;

     Concatenate

     Load Item,Comp,Amount*2 as Amount

     Resident Data;

Regards,

Kaushik Solanki

Not applicable

Re: Generate new records from existing records

Thanks Kaushik for your reply. However,

sorry, i should have mentioned that it would be Item specific rather than all items. Say there are 100 items, and I want 101st item to be like that (Calc3 = Item ->1 *2)

preminqlik
Valued Contributor II

Re: Generate new records from existing records

i think there will be another field that it indicates last item, for example date...can you please mention that....

Not applicable

Re: Generate new records from existing records

Kaushik's answer is OK.

Add a WHERE statement if the computation should be done on some items only.

Fabrice

Not applicable

Re: Generate new records from existing records

Prem,

No it's not about last item. It is simply about creating a new record which has a reference to another/more records. It may be like:

Input:

Item Comp Amt

1     A     1

1     B     2

2     A     3

2     B     4

Output:

Item Comp Amt

1     A     1

Calc3     A     (amt of item->1)*2 =2

1     B     2

Calc3     B     (amt of item->1)*2 =4

2     A     3

2     B     4

Hope, it's bit clearer.

Not applicable

Re: Generate new records from existing records

What are the items ? How do you catch them ?

Fabrice

Not applicable

Re: Generate new records from existing records

Nope ! Let me rephrase it:

Create a new RECORD which is calculated against some other records:

Like,

Input:

Item

1

2

3

Output:

Item

1

2

3

4             // 4 is calculated like item1+item2

Re: Generate new records from existing records

Try this,

     Data:

          Load Item,Comp,Amount

          From xyz;

     Concatenate

    first 10 Load Item,Comp,Amount*2 as Amount

     Resident Data;

Regards,

Kaushik Solanki

Community Browser