Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding two fields in the script


Hi there,

I have recently started using qlikview. I need some assistance. As an example, there are two fields 'Branch X' and 'Branch Z':

Branch X      Branch Z   

  12                   8

  30                   6

  40                   4 

How do I add these two fields in qlikview. I know I can add these in excel and then upload it again in qlikview. But is there another way.

I tried adding the following line in the script but it didn't work:

[Branch X] + [Branch Z] as [Total Sales]

Can anyone please tell me what I am doing wrong

Your assistance will be highly appreciated.

Thanks,

Patrick

1 Solution

Accepted Solutions
ashfaq_haseeb
Champion III
Champion III

Hi you can load as it is and in fron end try below

=sum([Branch X]) + sum([Branch Z])


Or in back-end try like below


Main:

LOAD *,

[Branch X]+[Branch Z] as [Total Sales];

LOAD * Inline

[

Branch X,Branch Z 

  12,8

  30,6

  40,4

  ]

  ;


Regards

ASHFAQ

View solution in original post

8 Replies
tresesco
MVP
MVP

Try like:

RangeSum([Branch X] , [Branch Z]) as [Total Sales]

ashfaq_haseeb
Champion III
Champion III

Hi you can load as it is and in fron end try below

=sum([Branch X]) + sum([Branch Z])


Or in back-end try like below


Main:

LOAD *,

[Branch X]+[Branch Z] as [Total Sales];

LOAD * Inline

[

Branch X,Branch Z 

  12,8

  30,6

  40,4

  ]

  ;


Regards

ASHFAQ

mdmukramali
Specialist III
Specialist III

Dear,

can you attach your sample file.

see the below script of sample data..

it's working fine.

Main:

LOAD * Inline

[

Branch X,Branch Z  

  12,8

  30,6

  40,4 

  ]

  ;

LOAD *,

[Branch X]+[Branch Z] as [Total Sales]

Resident Main;

DROP Table Main;



Thanks,

Mukram.

MarcoWedel

SHould work like you tried.

Please post example app / data

amit_saini
Master III
Master III

Patrick,

Hope this attachment will help you.

Thanks,
AS

khajafareed
Contributor III
Contributor III

try inline load

T1:

LOAD * Inline

[

Branch X,Branch Z  

  12,8

  30,6

  40,4 

  ]

  ;

LOAD *,

[Branch X]+[Branch Z] as [Total Sales]

Resident T1;

DROP Table T1;


Not applicable
Author

You guys are amazing! Thanks for the prompt responses

Both of the following worked.

 

[Branch X]+[Branch Z] as [Total Sales]

RangeSum([Branch X] , [Branch Z]) as [Total Sales]

Don't know why at first it was not working. But all good now.

Thank you very much

Cheers

ashfaq_haseeb
Champion III
Champion III

Hi Can you close this thread by marking appropriate answer.

Regards

ASHFAQ