Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm just starting out with QlikView, but I'm struggling a little to get into the syntax side of things (I'm happy enough pulling the data from Excel and SQL DBs). I have a small set of sales data and I want to calculate a weekly contribution percentage. So, for example in the table below I have the first three columns, but I can't work out how to calculate the fourth:
Product | Week | Sales (£) | Contribution |
---|---|---|---|
1 | 1 | 7 | 29% |
2 | 1 | 8 | 33% |
3 | 1 | 9 | 38% |
1 | 2 | 11 | 44% |
2 | 2 | 8 | 32% |
3 | 2 | 6 | 24% |
I've used sum(sales)/sum(total sales) to get an overall contribution, but this isn't particularly useful. What am I missing?
Thanks!
Graham
Hi Graham,
You almost had it right. You need to use <Week> as qualifier to prevent using all sales, but only the sales of the corresponding week.
sum(Sales) / sum( TOTAL <Week> Sales)
HTH Jeroen
Hi Graham,
You almost had it right. You need to use <Week> as qualifier to prevent using all sales, but only the sales of the corresponding week.
sum(Sales) / sum( TOTAL <Week> Sales)
HTH Jeroen
Perfect! Thank you
Graham