Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i've got the following pivot table
Resort Sales (=sum(Sales_1_Day) .....
A 50 ...
B 30 ...
Total 80 ...
now I want to have an additional row with following
sum(if(Resort = 'A', Sales_1_Day)) / sum(if(Resort='B', Sales_1_Day)) -> 50 /30 = 1,667:
Resort Sales (=sum(Sales_1_Day) .....
A 50 ...
B 30 ...
Total 80 ...
A/B 1,67 ...
Maybe someone can help me,
thanx a lot...
meili
I can't figure out any way to do it within pivot table. If its just a single row you can add a text box next to the pivot table and use this expression within text box, else you have handle this at script level. Might be some can suggest a better way to do it 🙂
~Sachin
You could pull it off by making a calculated dimension that includes all the values for Resort, 'Total' and 'A/B'. Then have the expression behave differently for 'Total' and 'A/B'. It's not a great solution, but it should work. I THINK I have an example somewhere if you need one. I'd just need to find it.
(Edit: Found it. Attached. It's even more complicated than I remembered. Hopefully someone else has a better solution.)
hi,
thank you all for your help although i cant really figure out how to solve the problem.:-(
In the above attached file I added a third column called resort and a pivot table.
Resort sum(test)
XX 49
YY 124
Total 173
Now a fourth row would be nice where i get XX/YY (49:124=0,395), instead of sum(test).
And there's not only one column sum(test) there are about 20 columns sum(test1), sum(test2)......
Thank you both for your help,
meili
ps. how do i get a qlikview-file in here?
Hi,
I had a similar requirement,
If the resort values 'XX' and 'YY' are fixed. Then you can reference them in the expression with some hardcoding.
John,
I've been searching all day for an answer. It looks like your post can solve my problem.
http://community.qlik.com/forums/t/40535.aspx
But why do you say it's not a great solution?
Rich
Well, the main thing I don't like about it is that it uses a calculated dimension. In my experience, calculated dimensions really slow down the associated charts. This calculated dimension seems particularly ugly due to the use of concat() in a valuelist(), which might cause problems if there were a large number of Products (perhaps a thousand or more?). QlikView isn't supposed to have a limitation on the size of expressions (the concat will be expanded into the expression, then the results evaluated), but in practice, I vaguely remember problems occurring. Then the expression has to do the same sort of complexity, which will probably slow the chart down any further.
Fortunately, that objection can be solved by making REAL values for the dimension. The attached example does that.
Other than that, it's not too bad, though probably in many cases the additional expressions might be handled through the data model instead of complicated chart expressions, which would be my preference. However, looking at your spreadsheet from the other thread, that seems like it would be complicated at best, and probably less clear than just playing with the expression as in the attached example. So with the modification to use a real dimension instead of a calculated one, yeah, on the surface this looks like a reasonable way to solve your problem.
John do me a favor and post your response (testAddValuesToTable.qvw) to my post.
http://community.qlik.com/forums/t/40535.aspx
I'd like to verify your response but I can do it here from this link.
By the way it's ugly. BUT it works and it was painful. I did it on a realtively easy one with just one dimension ... year.
Now I'm going to need to concatenate the Region and year, then Salesperson and year. then ...
Thanks for your help.