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: 
ananyaghosh
Creator III
Creator III

Which is correct: sum(sales/10000) or sum(sales)/10000?

Hi,

Please give me a suggestion that which is the correct way to use sum function:

sum(sales/10000)

or

sum(sales)/10000

and I have noticed that value is changed for some data.

Please suggest with an example.

Thanks,

Sandip

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Its largely a matter of style. The second one is marginally more efficient and may execute slightly faster and this will be more important if the data set is large. So I would generally move the constant out of the sum().

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
awhitfield
Partner - Champion
Partner - Champion

the second one

Andy

Anonymous
Not applicable

Hi Sandeep,

As we are using sum here, both shouldn't make any difference. And choosing the correct way depends on the requirement.

jonathandienst
Partner - Champion III
Partner - Champion III

Its largely a matter of style. The second one is marginally more efficient and may execute slightly faster and this will be more important if the data set is large. So I would generally move the constant out of the sum().

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein