Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Pablo_MC
Contributor
Contributor

Compare vs same sales

Hi everyone and thanks in advance. 

I have a complicated requirement that i can't achieve, i hope you can help me. 

I have this data set:

TeamProductSales
AOranges60
AApples10
ABananas20
BOranges30
BStrawberries10
Bwatermelons20
CApples100
Cwatermelons

50

DStrawberries

70

 

I want to compare each team with the average of the teams but only comparing the products that it sell. 

For example, team D only sell strawberries, so the average they want to compare is = B(but only sales from strawberries) and D (all of its sales) .

Final result that i want to achieve:

 Average salesAverage of teams selling same products
A3040AVG Sells from A (oranges, apples, bananas) , B(oranges) , C (apples, banana)
B2050AVG Sells from B (oranges, strawberries, watermelon) ,A(oranges) , C (watermelon), D ( strawberry)
C7536,66666667AVG sells from C (apples, watermelon, banana), A (apples, banana), B(Watermelon)
D7040AVG sells from D, B (strawberries)

 

Case of team A in numbers is avg(avg(60;10;20);30;avg(100;20)). 

Can i achieve this on set analysis ? 

Thanks!

Labels (1)
2 Replies
Thiago_Justen_

Hello my friend. What's up?

I guess your output isn't correct based on the data you provide us. See that Team C didn't sell banana.

Anyway, I got the output below. I hope it gets you some insights.

output_avg.png

 

 

 

 

 

 

 

The script I've used is attached.

Feel free to contact me.

Take care 😉

 

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
Pablo_MC
Contributor
Contributor
Author

Thank you Thiago.

Yes, i've made a mistake in the output, C didn't sell banana.

Your solution it's ok but i need to do it in expressions and not in script. I have several fields that users can filter on it and i can't have the value loaded in script.

Thanks!