I've stumbled upon a rather annoying problem I can't seem to solve.
Despite finding many questions related to this and trying some solutions I've reached a dead end.
I am asking for your help concerning weighted averages.
You see, I have a table with Sales: sum(Volume) and Prices: sum(Prices)/sum(sales) as expressions and Market as dimension.
Something like this:
This table is for 2016, but I need two extra columns for 2015 (Sales + Price 2015). I created them as well in Qlik, no problem.
The problem is, I need to find the mix effect of one year vs another.
Now the way I do this in excel is simply sumproduct the prices 2016 * the sales volume 2015, and them divide that by the total sales volume 2015.
I'm not worried about the mix effect by market, but in TOTAL. For example, if the price is now 284, and with the weight of sales 2015, the price would be... 280, for example. That's a difference of 4 euros.
What QV gives me (BELOW) is the correct expression for each market, of course. But I need the total effect, not the effect by market. However, I need to ponder each market weight for the formula to work.
As you can see, the total remains the same as Price 2016: 283.537 €
The correct value would be 283.957 € if I use sumproduct() in excel. The correct difference is 0.42 €.
I can't really find a solution. This is part of a very important report to be issued every week in the company. Could you help?
Which formula can I use to calculate something like this weighted average? Would I remove the dimension?
What I need is a simple Sumproduct(Sales;Price) / sum(Total Sales 2015).
If this is not the correct method, could you give me any alternatives for calculating such an average?
Unfortunately, I have one of those "data is confidential" problems.
I can share the expressions, no problem.
I managed to find the correct number by multiplying the weight in % of the volume 2015 by the price 2016.
If I cummulate that expression, I get the correct value I was talking about above!
Below is the accurate chart. The values in black are real, so I cannot share them. So I multiplied each weight (year) by the price 2016 and got expressions A and B. The last column is the same as B-A but cummulated.
My problem is I wanted this fairly automatic in order to get a bar chart and put it on a report.
Once again it is difficult to look at screenshots and try to understand what might not be working. A sample will make it much more easier to offer a help. Sample of dummy data with expected output will also be helpful.