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

set analysis problem

Hi all,

     I have a table  :

MonthAreaSale
1A191
1B210
1C180
1D200
2A90
2B200
2C180
2D119

I want to create a chart like this :

Areaavgsumsum(Sale > Avg,Sale)
A140.5281191
B205410210
C1803600
D159.5319200

But i don't know how to calculate the third one: sum all the Sale which are larger than the Area's avg.

Pls help me. Find the qvw file from the attachment.

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This is the expression you need:

Sum(Aggr(If(Sale >= Avg(TOTAL <Area> Sale), Sale), Area, Month))

OR

Sum(Aggr(If(Sale > Avg(TOTAL <Area> Sale), Sale), Area, Month))

(Which one depends on how you want to handle Area C)

HTH

Jonathan

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

View solution in original post

9 Replies
amars
Specialist
Specialist


Check attached file

Not applicable
Author

Dear amars,

     Maybe you misunderstand my purpose, for each Area, I want to sum all the Sale of the Area which are larger than the avg Sale of the corresponding Area. the final chart may like this:

Areaavgsumsum(Sale > Avg,Sale)
A140.5281191
B205410210
C1803600
D159.5319200

My English is not so good, i don't know whether it makes you understood.

Thanks,

zhou

sreenivas
Creator III
Creator III


PFA file

Not applicable
Author

Thank you Sree Nivas. Your suggestion works well for my test app. But my real app is much more complicated, I can't do as what you suggested.

Thanks,

zhou

sreenivas
Creator III
Creator III

Chek this Updated file

Not applicable
Author


Thank you Sree Nivas. Your solution won't work if i have data of more than 2 months. Thanks anyway.

er_mohit
Master II
Master II

Try this

if(aggr(max(Sale),Area)>avg(Sale),max(Sale),0)

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This is the expression you need:

Sum(Aggr(If(Sale >= Avg(TOTAL <Area> Sale), Sale), Area, Month))

OR

Sum(Aggr(If(Sale > Avg(TOTAL <Area> Sale), Sale), Area, Month))

(Which one depends on how you want to handle Area C)

HTH

Jonathan

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

You're right. Thank you Jonathan Dienst.

I've known this approach. It's usefull. Thanks.