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

How do I use the sum of rows value in an expression instead of expression total?



My error percent is not working right in a straight table when I use expression total. It gives a very low number instead of a high number.

Here's the metric:

Stdunits, histunits

Error =fabs( stdunits - histunits)

Error percent= error/STD units

For instance, expression total of stdunits is 6.12mil, histunits is 7.1mil. Error sum in total line is not the expression total but sum of rows.

How do I make the error percent use the sum of rows value in the numerator instead of expression total?



3 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

On the Expressions Tab, find the setting "Total Mode". You can replace the default "Expression Total" by the "Sum of Rows"

Not applicable
Author

Hi Oleg,

Thanks for your quick reply!Perhaps this is a silly question.

However, What I am looking for is probably best understood if you take a look at the attached Test.qvw.

If you see in the table, the sum of error is 30. If you calculate, the sum of Std is 55. What I want in the vacant Error percentage top cell is the division of 30 by 55, that is, 54.54% and not 411.07%.

Thanks again for your time.

- Souvik.

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Souvik,

see attached corrected example.

In order to aggregate properly, all chart expressions need to use aggregation functions like sum(), avg(), etc... Then they can be properly evaluated at the total. Even when your detailed lines don't require any aggregation, you should use aggregation functions for the total levels to work properly.