Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this,

     Data:

          Load Item,Comp,Amount

          From xyz;

     Concatenate

     Load Item,Comp,Amount*2 as Amount

     Resident Data;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

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
Specialist II
Specialist II

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

Not applicable
Author

Kaushik's answer is OK.

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

Fabrice

Not applicable
Author

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
Author

What are the items ? How do you catch them ?

Fabrice

Not applicable
Author

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

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this,

     Data:

          Load Item,Comp,Amount

          From xyz;

     Concatenate

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

     Resident Data;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!