Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

SUM Multiple Fields

Dear experts


I am trying to derive a percentage using the Expression below, it will display in a text object (its a visual thing).

=num(sum([field 1])+sum([field 2])+sum([field 3])/sum([field 4]),'#0%'

I get the statement 'Expression OK' but the figure I get back is neither correct in value or formatted as a %.

I am new to this, so not yet familiar with the 'language' and common methodologies - using QV 11.2

Grateful for any guidance.

Jason.

Tags (1)
1 Solution

Accepted Solutions
Highlighted

Re: SUM Multiple Fields

You can also try this:

=Num((Sum([field 1])+Sum([field 2])+Sum([field 3]))/Sum([field 4]),'#0%')

View solution in original post

8 Replies
Highlighted
MVP
MVP

Re: SUM Multiple Fields

Maybe

=num( Rangesum(sum([field 1]),sum([field 2]),sum([field 3]) ) /sum([field 4]),'#0%')

Highlighted
Contributor
Contributor

Re: SUM Multiple Fields

Thanks Stefan - but this seems return the value of Field 1 + Field 2 only.

Highlighted

Re: SUM Multiple Fields

You can also try this:

=Num((Sum([field 1])+Sum([field 2])+Sum([field 3]))/Sum([field 4]),'#0%')

View solution in original post

Highlighted
Contributor
Contributor

Re: SUM Multiple Fields

Perfect - Thank you Sunny - I was warned it would all be in the brackets! 🙂

Jason

Highlighted
MVP
MVP

Re: SUM Multiple Fields

Yes, or maybe even

=num(Sum( Rangesum( [field 1],[field 2],[field 3]) ) / sum([field 4]),'#0%')


Bottom line: Take care of multiplication / division operator precedes addition operator rule, use brackets or functions to get the sum of fields right before dividing it by the denominator.

Highlighted
Contributor
Contributor

Re: SUM Multiple Fields

Thank you for the additional method and sound advice Stefan, very much appreciated.

Highlighted
MVP
MVP

Re: SUM Multiple Fields

Without knowing your data model (e.g. your fields are located in different tables) and data, it's hard to tell why this is happening.

But glad you got it working.

Highlighted
Contributor
Contributor

Re: SUM Multiple Fields

I found the following to work in QlikSense for me, using the "rangesum" replacing all "sum" and using "," instead of "+"

num(rangesum([field 1])/Rangesum(rangesum([field 2]),rangesum([field 3]),rangesum([field 4])) ,'#0%')