Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why sum(field_A*field_B) doesn't work?

There should be some reason but I can't understand why this doesn't work as expression in a chart:

=Sum(Price * Quantity)

when apparently should give the same result as:

=Sum(Sales)

(being Price, Quantity and Sales 3 fields of a table).

What surprises me is that:

=Sum(Sales*1)

doesn't work neither.

Can someone explain to me?

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

Hi,

I tried to reproduce you problem, but this syntax works fine for me.

when you multiply fields inside the sum(), it's better if the are part of the same table.

The sum(Field1 * 1 ) should always work...

You can check my file attached.

Hope it helps,

Erich

View solution in original post

3 Replies
MichaelTerenzi
Partner Ambassador
Partner Ambassador

Can you upload your qvw so we can all have a better look at what you're doing?

erichshiino
Partner - Master
Partner - Master

Hi,

I tried to reproduce you problem, but this syntax works fine for me.

when you multiply fields inside the sum(), it's better if the are part of the same table.

The sum(Field1 * 1 ) should always work...

You can check my file attached.

Hope it helps,

Erich

Not applicable
Author

Oh, I'm sorry guys!


Problem was that I was showing the expression in a LED gauge and forgot to format the number to "fixed to 0 decimals"


The simple fact to add "*1" caused that the result did not fit in the display.