Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Fields wont sum in script

Hi

Any possible solutions as to why two fields wont add in a script?

For example:

Tmp2:

load

*,

Budget1 + Budget2 as BudgetNew

Resident Tmp;

However, if I mulitiply or add to the fields Budget1 and Budget2 it works.

For example:

Tmp3:

load

     *,

     Budget1  * 2 as BudgetTmp1,

     Budget2 + 10 as BudgetTmp2

Resident Tmp;

Regards,

Magen

10 Replies
m_woolf
Master II
Master II

Try

Rangesum(Budget1,Budget2) as BudgetNew

Not applicable
Author

Hi Michael

Thanks for your reponse. Unfortunately it doesnt work.

Please see results below.

Budget1Budget2BudgetNew
-00
-66.0166.01
-652.25652.25
-841.4841.4
-861.55861.55
-897.49897.49
-917.78917.78
-942.41942.41
-1076.051076.05
-1080.091080.09
429.82-429.82
873-873
997.56-997.56
1046-1046
1161.16-1161.16
1328-1328
1650-1650
1666-1666
1688.96-1688.96

Regards,

Magen

m_woolf
Master II
Master II

Are your Budget1 and Budget2 fields in the same table?

ashfaq_haseeb
Champion III
Champion III

Hi,

This means you don't have Granular Data.

I.e there is no logical connection between Budget1 and Budget 2.

You need to look at your data model.

Regards

ASHFAQ

Not applicable
Author

Hi

Try this

Tmp2:

load

*,

ALT(Budget1,0) +ALT( Budget2,0) as BudgetNew

Resident Tmp;

martinpohl
Partner - Master
Partner - Master

As I can see you have load datas from source one within the field Budget1 and then datas from a second source within Budget2.

Now you want to calculate these two values but they are not in the same line.

is it possible to join Budget1 and Budget2 over a key field.

e.g.

Temp:

load

profitcenter,

Budget1

from Data1.xls;

left join

load

profitcenter,

Budget2

from Data2.xls;

Facts:

load *,

Budget1+Budget2 as NewBudget

resident Temp;

drop table Temp;

Not applicable
Author

Are the numbers in the same format?

Your original method did work for me, please see included dashboard!

Kasia

Not applicable
Author

Yes Michael

Both fields are in the same table.

Regards,

Magen

m_woolf
Master II
Master II

Then I think that on any one individual records the are no instances where Budget1 and Budget2 both have values.