Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Divide the value in one row with value in another row in same field.

For example, I have a table like

Load * inline

[Year,Month,A,B,C

1994,1,'a',100,'x'

1994,'1','b',10,2,'y'

and so on...

]

I want to add rows like

1994,1,c,100/10,1....

Can anyone please help.

1 Solution

Accepted Solutions
sunny_talwar

May be like this

Table:

Load * inline

[Year,Month,A,B,C

1994, 1, a, 100, x

1994, 1, b, 10, 2, y

];

TmpTable:

LOAD Year,

  Month,

  'c' as A,

  B as B1

Resident Table

Where A = 'a';

Left Join (TmpTable)

LOAD Year,

  Month,

  'c' as A,

  B as B2

Resident Table

Where A = 'b';

Concatenate(Table)

LOAD Year,

  Month,

  A,

  B1/B2 as B

Resident TmpTable;

DROP Table TmpTable;

View solution in original post

4 Replies
sunny_talwar

In script?

Anonymous
Not applicable
Author

Yes. While loading the data i need  to divide the field values.

sunny_talwar

May be like this

Table:

Load * inline

[Year,Month,A,B,C

1994, 1, a, 100, x

1994, 1, b, 10, 2, y

];

TmpTable:

LOAD Year,

  Month,

  'c' as A,

  B as B1

Resident Table

Where A = 'a';

Left Join (TmpTable)

LOAD Year,

  Month,

  'c' as A,

  B as B2

Resident Table

Where A = 'b';

Concatenate(Table)

LOAD Year,

  Month,

  A,

  B1/B2 as B

Resident TmpTable;

DROP Table TmpTable;

Anonymous
Not applicable
Author

Thank you for your help. That is the process we thought too. I want to know if there is any simpler way to achive this.