Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Total Sum and Average On Expression

Hi Everyone,

I am trying to do a total sum based on a grade as well as an average. This will be for a complicated calculation, where if the sum of sales is above the average, would get 1, and if below would get 2. and then concatenate it with the grade, example, A1, A2, B1, B2. I have attached my example, i am still looking into this problem, but would welcome some help with this issue. I would also want to do this on the total sum of the grade. Please see the attached example.

If i manage to find a solution, i will post my results, otherwise if someone has any advice, i would really appreciate it. I unfortunately cant do this in the script, as i am loading my information from multiple sources.

Thanks,

Andrew Kersys

1 Solution

Accepted Solutions
Not applicable
Author

8 Replies
Not applicable
Author

Do you mean something like Sum(TOTAL <Type> Value)

Not applicable
Author

Yes however the <Type> would be my expression of Grade,

example

sum(TOTAL <Grade='A'> Value). i need something like this to be done, this works when using a dimension as Type, however i am basing this off another expression and so when i do it with an expression i get 0.

preminqlik
Specialist II
Specialist II

Hi There find attachment

Here you if you do in front end you have to use "ALL claue"   sum(Cummulative)/sum(all value)

the attachment is in backend version ...will try in front end soon..

-@

Premhas

Not applicable
Author

Thanks Prem,

And yes, i really need to do it in the front end. as mentioned i am loading information from 2-3 different locations to build my report, and changes based on some selections that the user will be choosing.

Not applicable
Author

Here is an example of what i am working with as an application. the example previously attached was much more simple.

image.png

as you can see, the average is calculated on the "final grade" and given their respective avg to all the styles of Grades A, B and C. Then i do a calculation based on this avg using the units sold to give it 1 if sales are above the average, and 2 if it is below the average.

i calculated avg, new grade manually in excel to show what i would like to do.

Not applicable
Author

Pls see attached.

I think I got something here but the Offsetting for above/below doesn't seem to be working right. Its not functioning as defined in the Help.

The ClassSum Column is yielding incorrect values..

Can you try your end?

Not applicable
Author

Found this.

Re: RangeAvg with Above/Below getting strange results

Please see attached revised app. HTH!!

Not applicable
Author

That is exactly what i was looking for, thank you so much.

You have saved me hours of headaches and attempts to figure this problem out.

Andrew Kersys