Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I've only just started working with QlikView this week as the company I work for is transitioning to it from Cognos and Excel.
We currently have a customer segmentation model built in Excel which I would like to replicate in QlikView.
Where I'm struggling is calculating average gross sales for our customer base as a whole.
I have a straight table that looks like this:
Location_ID | Gross Sales | Gross Margin | N. SKUs purchased | Average SKUs purchased | Average gross sales |
---|---|---|---|---|---|
1 | 3 | 1.5 | 10 | ||
2 | 2 | 1 | 4 | ||
3 | 1 | 0.5 | 2 | ||
4 | 2 | 1 | 5 |
I'm struggling to fill the last two columns with the data I want for subsequent calculations. The last two columns should contain the same number all the way from the top to the bottom. Average SKUs in the example above would be 5.25 and Average gross sales would be 2.
What function should I be using and how should I be scripting it? Is it a variation on Aggr?
Thanks for your help,
Peter
Hi Peter, If you just use Avg(Total [Gross Sales]), that should work.
hi
sum(Total GrossSales)/count(GrossSales)
Hi Peter,
For Average SKUs purchased, you can use : =AVG (TOTAL [N. SKUs purchased]) and for Average gross sales you can use : =AVG(TOTAL [Gross Sales])
Hope this helps!
Hi,
I you want below output:
Then you need to add two expressions for calculating average.
1). Avg([N. SKUs purchased])
2). Avg([Gross Sales])
Thanks for your replies, I've managed to get the right answer for the the Average SKUs for which I used this:
=avg(Total Aggr(count(SKU), location_id)
Rather than have different values against each location I want to have the same value against each. I hope that makes some sort of sense?
Thanks for your replies, I've managed to get the right answer for the the Average SKUs for which I used this:
=avg(Total Aggr(count(SKU), location_id)
Rather than have different values against each location I want to have the same value against each. I hope that makes some sort of sense?