Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SUM in load script doesn't work

Hey users!

My question is very easy and I wonder that I don't get it.

This is my load script:

sum_load_script.jpg

The result is, that it shows me the two field again, but I want a sum. It has to sum the values. 3 + 6 = 9. I thought that's what sum do!

Thanks for you help!

Your Sometimes-Desperate-Inga

12 Replies
hic
Former Employee
Former Employee

No, Sum() only works together with a Group By. If you want to accumulate, you should use

     Rangesum(Peek(Kumuliert),Betrag) as Kumuliert.

And make sure that it is correctly sorted...

HIC

Not applicable
Author

At script label,

if you are using

sum(@56) as [kumuliert: Ausleihen gesamt ]

then must be used groupby.

**********************************************

you can simply try in your expression

sum(Total(@56))

sivarajs
Specialist II
Specialist II

Since you are grouping by signatur it wont give you total 9 because if you note the signatur, both the values are different. So it wont get sum up

Not applicable
Author

Perhaps, I can show better what I've done, if you see my group by.

sum_load_new.jpg

sum_load_ergebnis.jpg

Hmmm, for example the 38 is grouped. But... There must be 106. And if I mark The 1 and the 21 in the table, there should be a 22.

Can you show me how to fill in in your rangesum-command? I don't get it.

Thanks for your help,

Inga

Not applicable
Author

Here you can see my group by. No, sum(total () ) doesn't work. But it was a good try.

sum_total.jpg

Thanks for your help.

Not applicable
Author

Hi,

1)Use group by, as Sum() in load script always works with Group by.

2) Since,you are using the signatur field as dimension and since it has got two different values.

so the data gets  bifurcated and you get two values 6 and 3 respectively.

Hope this helps,

Regards,

Snehal Nabar

Not applicable
Author

Sum(Total(@56)) work in expression of Pivote table.

Not applicable
Author

Hi,

1)Use group by, as Sum() in load script always works with Group by.

2) Since,you are using the signatur field as dimension and since it has got two different values.

so the data gets  bifurcated and you get two values 6 and 3 respectively.

Hope this helps,

Regards,

Snehal Nabar

hic
Former Employee
Former Employee

The best solution for accumulation is often not to do it in the script. Instead you should do it in a chart/pivot table.

If you just load the data you have without any group by in the script, and then create a chart where you define two expressions:

     Sum([Ausleihen gesamt])

     RangeSum(Above(Kumuliert), Sum([Ausleihen gesamt]))

and label the second expression "Kumuliert", then I think you will get what you want.

HIC