Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add a column to resident table

Hi,

I need to add a calculated column to a resident table.

I am using this way...

[Table_2]

Load *,

Amount * quantity as totalAmount

Resident Table_1;

Drop table Table_1;

It works but when i need to ad several columns which depends on an other calculated columns then i need to repeat this process...like

If i want to add percentage of totalAmount then i need to repeat this process like

[Table_3]

Load * ,

totalAmount * .01 as percentage

Resident Table_2;

Drop Table Table_2;

Can I do both operations in one Load statement?

Regards,

Saurabh

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi Saurabh,

You can try this method:

1. Method1 (Preferable)

[Table_2]

Load *, totalAmount*0.01 AS percentage;

Load

  *,

  Amount * quantity AS totalAmount,

Resident Table_1;

Drop table Table_1;

===============================

2. Method2

[Table_2]

Load

  *,

  Amount * quantity AS totalAmount,

  Amount * quantity * 0.01 AS percentage

Resident Table_1;

Drop table Table_1;

Regards,

Sokkorn

View solution in original post

1 Reply
Sokkorn
Master
Master

Hi Saurabh,

You can try this method:

1. Method1 (Preferable)

[Table_2]

Load *, totalAmount*0.01 AS percentage;

Load

  *,

  Amount * quantity AS totalAmount,

Resident Table_1;

Drop table Table_1;

===============================

2. Method2

[Table_2]

Load

  *,

  Amount * quantity AS totalAmount,

  Amount * quantity * 0.01 AS percentage

Resident Table_1;

Drop table Table_1;

Regards,

Sokkorn