# Community Corner

Discussion board for questions about the Qlik Community Platform as well as general discussions and even some fun. This is for both new and longtime community members. Everyone is welcome!

cancel
Showing results for
Did you mean:
Not applicable

## Pie Chart - Part vs Others

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

1 Solution

Accepted Solutions
Partner

Using the same dimension as above, try the follow expression:

if(ValueList('\$(=only([Customer]))', 'Others') = 'Others',

sum({<Customer=E()>} Sales),

sum(Sales)

)

10 Replies
Partner

Try SUM(Sales)/SUM({1} Sales) as the expression for your pie chart.  Tick the "Show in percent" box.

Hope this helps,

Jason

Not applicable
Author

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?

Partner

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.

Partner

Nice

Not applicable
Author

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

Partner

What do you mean "filter by year"?  The {1-\$} means the inverse of all current selections.

Not applicable
Author

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.

Contributor III

Hi Gabriel,

You can try this:

- remove any dimension

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

Partner

Using the same dimension as above, try the follow expression:

if(ValueList('\$(=only([Customer]))', 'Others') = 'Others',

sum({<Customer=E()>} Sales),

sum(Sales)

)

Community Browser