Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Could you tell me how can I create a Pie Chart selecting one value from one dimension and create an "Others" with all the others dimension's value?
Dimension: Customer
Expression: Sum(Sales)
Relative - Checked.
I want to see the % of sales for one selected customer vs the % of the others (all together).
Regards,
- Gabriel
Using the same dimension as above, try the follow expression:
if(ValueList('$(=only([Customer]))', 'Others') = 'Others',
sum({<Customer=E()>} Sales),
sum(Sales)
)
Try SUM(Sales)/SUM({1} Sales) as the expression for your pie chart. Tick the "Show in percent" box.
Hope this helps,
Jason
Thank you Jason, but I still do not get a part-to-whole Pie Chart.
What are the needed expression(s) in order to have this Pie Chart?
Hi Garbiel.
I was looking to do the same type of chart and found an excellent solution and example from Oleg T. using a synthetic dimension. Use the following link: http://community.qlik.com/message/46244#46244
John.
Nice
Thank you guys.
I still have one question. Regarding the example on John's link: there is a chart with one selected value using a synthetic dimension and "others" and an expression to calculate the sales for each one.
Synthetic Dimension: =ValueList('$(=only([Customer]))', 'Others')
Expression: if(ValueList('$(=only([Customer]))', 'Others') = 'Others',
sum({1-$} Sales),
sum(Sales)
)
Do you know how can I filter per year or category on the first sum: sum({1-$} Sales) ?
I would like to filter by year, supplier, etc but there is the {1-$}
Thank you once again.
- Gabriel
What do you mean "filter by year"? The {1-$} means the inverse of all current selections.
I mean that I do want to consider all other fileds to filter by them but not the Customer that I want to select one value and compare it with all others.
Hi Gabriel,
You can try this:
- remove any dimension
- add two expressions:
Selected: sum( {$<Customer=P({$}) >} Sales)
Others: sum( {$<Customer=E({$}) >} Sales)
Keep in mind that if you select a year which excludes one of the Customers in the current selection, they'll become a part of the 'Others'.
If you insist that the chart works for only 1 selected customer, add this:
if ( count ( distinct Customer)=1, ...
to the expression, or calculation condition, or conditional show.
Let me know if it works please;
Dilyana
Using the same dimension as above, try the follow expression:
if(ValueList('$(=only([Customer]))', 'Others') = 'Others',
sum({<Customer=E()>} Sales),
sum(Sales)
)