Qlik Community

Community Corner

Discussion board for questions about the Qlik Community, its features, sharing information, general discussions and even some fun. This is for both new and longtime community members. Everyone is welcome!

Highlighted
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
jason_michaelid
Honored Contributor II

Pie Chart - Part vs Others

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

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

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

                        sum(Sales)

                   )

10 Replies
jason_michaelid
Honored Contributor II

Pie Chart - Part vs Others

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

Pie Chart - Part vs Others

Thank you Jason, but I still do not get a part-to-whole Pie Chart.

part-to-whole.JPG

What are the needed expression(s) in order to have this Pie Chart?

Partner
Partner

Re: Pie Chart - Part vs Others

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.

jason_michaelid
Honored Contributor II

Pie Chart - Part vs Others

Nice

Not applicable

Re: Pie Chart - Part vs Others

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

jason_michaelid
Honored Contributor II

Pie Chart - Part vs Others

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

Not applicable

Re: Pie Chart - Part vs Others

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.

divanova
New Contributor III

Re: Pie Chart - Part vs 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

jason_michaelid
Honored Contributor II

Pie Chart - Part vs Others

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

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

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

                        sum(Sales)

                   )