Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a Pie chart with only expressions. I see the values there. Now I want to have the Relative percentages among themselves.
Now I want it like this i.e Percentage among themselves to the total sum of these expressions.
How can I achieve that? I tried to activate Relative box in the expression tab for all expressions but it gives a common 16,67 for each which is not correct.
Regards
Sravan
hi there
i cannot show you in your model how to to do it sine i cannot reload your model
add this to your load script:
LOAD * INLINE [
your_field_name
Values
Percentage
];
make sure the field name does not exist in your model
after reload you will have a table with 1 field and 2 values but it will not be connected to any other table.
then put a listbox with that field into the layout.
make sure you check the "always only one selected" checkbox.
then using the function getFieldselections(your_field_name)
you can switch between the "value" and "percentage" in your expressions.
(with an if statement switch between your old expression and my new expression for each of the expressions
i attached your model with how i did the percentage thing but you will have to do the rest yourself.
hope that helps.
Mansyno
Hi.
See exemple. I hope to help you.
Regards.
hmm
"....I have a Pie chart with only expressions....."
i think here lies the problem.
since you are using separate expressions for each value in your chart, qlikview has no way to calculate the total. you must do it for him.
one idea i have is this.
create a boolean variable
using an IF() statement that checks the value of the variable like that:
if($(YourVar) , normal expression, percentagefOfTotal expression).
put that in each of your expressions.
now use a macro to let the user change the value of the variable from false to true and vice verse.
instead of a variable you could creat small "Island" table in the script with 2 values
then put it as a listbox for the user. dont forget to check the "only one selected" checkmark in the LB properties
and now instead of using the variable you use the getcurrentselections() function. and the user can select what to watch.
another way could also be to make to charts one on top of the other , one with the values and one with the Percentage
and use a button to switch among them
or maybe you can concat the Percentage into the end of the expressions lables
that way they will show on the legend
hope i was of help:)
Mansyno
Hi Mansyno,
Thanks for your answer and a detailed Explanation.You speak of switching from Values and Percentages but I am seeing to get the Percentages first. After that the next step may be to switch according to Button or an Island table. If I am not getting your point, can you please see the attachment and suggest the changes. I dont like Macro solution but the other solution with Island and LB I find good.
[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.49.52/38347.Forumproblem143Solved.qvw]
Thanks in advance
sravan
How about having the percentage displayed when the user rollsover a slice with the cursor?
Just create the expression and check Enable/Relative/Invisible (all 3 of them) and then check 'text as pop-up'.
Regards,
Gordon
Hi Gordan
I did not get you what you want to say. To Make it more clear, the expressions(6) as below are calculated differently and the percentage is obtained as in the fig Below by dividing with the Total value of Expressions.
For Ex: Idle = 7500/24900 = 30,12%
I dont know how to get the Percentages as in the Above table. Hope I am clear now.
Regards
Sravan
hi there
i cannot show you in your model how to to do it sine i cannot reload your model
add this to your load script:
LOAD * INLINE [
your_field_name
Values
Percentage
];
make sure the field name does not exist in your model
after reload you will have a table with 1 field and 2 values but it will not be connected to any other table.
then put a listbox with that field into the layout.
make sure you check the "always only one selected" checkbox.
then using the function getFieldselections(your_field_name)
you can switch between the "value" and "percentage" in your expressions.
(with an if statement switch between your old expression and my new expression for each of the expressions
i attached your model with how i did the percentage thing but you will have to do the rest yourself.
hope that helps.
Mansyno
HI Mansyno,
Thanks for the Answer but I wonder what performance Problems this solution will give at the end as it includes SetAnalysis and If statements etc if thousands of Data are present. Now it is anyway for 2 Machines. I think I need to make a lot of calculations in the script.
Thanks a lot
Regards
Sravan