Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

New value as quotient of other two value

Hello everyone,

I would like to create new value of some field which is equal quotient of other two value of that field.

What I really want?

I want to make value 'PBT MARGIN' (row 53) which is quotient of value 'PBT' (row 52) and 'REVENUE' (row 11). Hope I managed to explain and hope you will help me.

1.png

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Create these calculated accounts in the script and concaenate to the original table. Like:

Load

          field1,

          field2,

          Accounts,

          Amount

From <>;

load

          field1,

          field2,

          'PBT Margin' as Accounts,

          Sum(If(Accounts='PBT' , Amount)) /Sum(If(Accounts='REVENUE', Amount)) as Amount

From <> Where Match(Accounts, 'PBT', 'REVENUE') Group By field1, field2 ;

View solution in original post

4 Replies
tresesco
MVP
MVP

Create these calculated accounts in the script and concaenate to the original table. Like:

Load

          field1,

          field2,

          Accounts,

          Amount

From <>;

load

          field1,

          field2,

          'PBT Margin' as Accounts,

          Sum(If(Accounts='PBT' , Amount)) /Sum(If(Accounts='REVENUE', Amount)) as Amount

From <> Where Match(Accounts, 'PBT', 'REVENUE') Group By field1, field2 ;

Not applicable
Author

Tnx bro, you really help me.

I set first if condition and then sum of field, and QV show me error that expression is not correct and I didn't now where i make mistake.

Is where condition necessary?

tresesco
MVP
MVP

Not necessary. But that would help you improve reload time.

paulyeo11
Master
Master

Hi Tres

I have issue on 2nd step on how to get the 2 field . see my enclosed QV doc.

Hope you can advise me .

Paul