Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Rsaiq
Creator
Creator

Add a column value into other column

Hi All,

We have a datasource where 2 amount columns are there i.e Cashflows and Invest

Now we need to select cashflows amount where TYPE =03.Dividend Income and Type=02.Sale and store in invest column. We need to replace the existing amount of Invest with cashflows amount.

shamshad8881_1-1625736456264.png

Please help me to resolve this issue

Kindly find attached sample data sheet

Thanks

 

Labels (3)
2 Solutions

Accepted Solutions
micheledenardi
Specialist II
Specialist II

You can achieve this in 2 ways, directly in the table using set analysis or during load script:

 

Via Set Analysis, use this as new Invest Expression:

Sum({<Type={'03.Dividend Income','02.Sale'}>}Cashflows)
+
Sum({<Type=-{'03.Dividend Income','02.Sale'}>}Invest)

 2021-07-08 11_49_28-test - Il mio nuovo foglio (16) _ Foglio - Qlik Sense.png

 

Or, during load Script:

LOAD
    ScriptID,
    Account,
    "Date",
    "Type",
    Cashflows,
    Invest,
    If(Match(Type,'03.Dividend Income','02.Sale'),Cashflows,Invest) as [Invest New]
FROM [lib://BaseFolder/3.DEV/_Temp/Sample.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

 

2021-07-08 11_53_34-test - Il mio nuovo foglio (16) _ Foglio - Qlik Sense.png

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

Rsaiq
Creator
Creator
Author

Thanks a lot micheledenardi...

Its working ...

View solution in original post

7 Replies
avinashelite

try like this 

if(TYPE ='03.Dividend Income' or  Type='02.Sale', cashflows,Invest) as Invest,

micheledenardi
Specialist II
Specialist II

You can achieve this in 2 ways, directly in the table using set analysis or during load script:

 

Via Set Analysis, use this as new Invest Expression:

Sum({<Type={'03.Dividend Income','02.Sale'}>}Cashflows)
+
Sum({<Type=-{'03.Dividend Income','02.Sale'}>}Invest)

 2021-07-08 11_49_28-test - Il mio nuovo foglio (16) _ Foglio - Qlik Sense.png

 

Or, during load Script:

LOAD
    ScriptID,
    Account,
    "Date",
    "Type",
    Cashflows,
    Invest,
    If(Match(Type,'03.Dividend Income','02.Sale'),Cashflows,Invest) as [Invest New]
FROM [lib://BaseFolder/3.DEV/_Temp/Sample.xlsx]
(ooxml, embedded labels, header is 1 lines, table is Sheet1);

 

2021-07-08 11_53_34-test - Il mio nuovo foglio (16) _ Foglio - Qlik Sense.png

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Rsaiq
Creator
Creator
Author

Thanks micheledenardi...

Its working well as per my requiremet

Could you please tell me how can i change the amount from negative to positive for max date only.

 In Above table max date is 31/12/2020 and amount is -1040000 in invest_New column,i need that amount to be in positive i.e 1040000.

 

Thanks once again.

Rsaiq
Creator
Creator
Author

Thanks avinashellite for reply will try this too.

micheledenardi
Specialist II
Specialist II

Create a variable which contains the maximum date, then use it into your expression:

2021-07-08 17_00_31-test - Il mio nuovo foglio (16) _ Foglio - Qlik Sense.png

 

(
	Sum({<Type={'03.Dividend Income','02.Sale'}>}Cashflows)
	+
	Sum({<Type=-{'03.Dividend Income','02.Sale'}>}Invest)
)
*
if(Date=vMaxDate,-1,1)

 

Last column contains above expression:

2021-07-08 17_02_17-test - Il mio nuovo foglio (16) _ Foglio - Qlik Sense.png

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Rsaiq
Creator
Creator
Author

Thanks a lot micheledenardi...

Its working ...

Rsaiq
Creator
Creator
Author