Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead 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
Jason_Michaelides
Luminary Alumni
Luminary Alumni

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

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

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

                        sum(Sales)

                   )

View solution in original post

10 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

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.

part-to-whole.JPG

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

john_duffy
Partner - Creator III
Partner - Creator III

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_Michaelides
Luminary Alumni
Luminary Alumni

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

Jason_Michaelides
Luminary Alumni
Luminary Alumni

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.

Anonymous
Not applicable
Author

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_Michaelides
Luminary Alumni
Luminary Alumni

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

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

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

                        sum(Sales)

                   )