Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pie chart with number and percent

Hi

I have 2 fields namely _Chart1Expression3 and _Chart1Expression2 that correspond to the metric in integer (Million scaling) and percent format.

I would like to display both of them in the pie chart using the technique below, however the Chart Legend only displays the numeric portion of the Show Numbers in Legend and not the Text Representation. Is there something I am missing?

dual($($(=_Chart1Expression3)) & ' M / ' & $($(=_Chart1Expression2)), $($(=_Chart1Expression3)))

_Chart1Expression3 = Num(SUM(Metric)/1000000, '#,##0')

_Chart1Expression2 = Num(SUM(Metric)/SUM(Total Metric), '#,##0%')

19 Replies
Not applicable
Author

unfortunately they are not. they are workarounds to the problem i have. it seems this might be a bug as Nag Aviral's solution has the same defect as mine and the others are not what I am looking for.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I see I misunderstood the question. I wouldn't agree it's a bug. The property on the Presentation/Legend is "Show Numbers in Legend". It is correctly showing the number value, not the text. Your reference to the Month example was for the legend Label - not the value -- which is correctly displayed as text.

-Rob

Not applicable
Author

Well it is a bug in that it will not accept the NUM() function for the formatting even it has to show numeric representation of the data as opposed to text.

Hoep this elaborates better.

Having to show percent on the data point and numbers next to it or in legend affords poor readability.

It seems I will have to resort to Y-value sorted Bar Chart as an alternative to achieve the task. It would have been ideal if the Pie achieved the same result

aveeeeeee7en
Specialist III
Specialist III

Please see the Modified Attachment.

Not applicable
Author

still not it

aveeeeeee7en
Specialist III
Specialist III

What exactly you Want. Be Clear & specific??

veidlburkhard
Creator III
Creator III

Hi Amir,

what about this solution:

PieChart.jpg

I looked at your test.qvw and found that, when using the dual function you'll get a result only, if in the 'Number' tab the check box 'Expression default' is marked. In this case the 'Show value in Legend' cannot show the result you want to see. So I unchecked the 'Show Legend' in the 'Presentation' tab and added the 'Dim1' field to the dual function. Also you have to check the 'Show Values on Datapoints' in the 'Expression' tab.

See below your modified qvw.

Enjoy

Burkhard

Anonymous
Not applicable
Author

the only way you can have two numbers next to legend in a pie chart, in your case, a percent value and the actual number value of the expression next to each other in the legend is by creating a work around. the way i did it on my end for a very similar requirement is create a straight table with the same dimensions and expression as pie chart and align it right next to the legend with no borders. the pie chart legend can show the real numbers and straight table can show percentages or vice versa.

Anonymous
Not applicable
Author

like this. since it is a straight table, it will still respond to your selections in pie chart or in the table and stay consistent..

1. in your pie chart, turn show numbers in legend off.

2. create a new straight table with same dimension as pie chart and two expressions - one for number and one for %.

3. in straight table, turn off borders (cell and table).

4. hide dimension column.

5. make sure your fonts are the same as legend and place the table right next to the pie chart legend and you have what you need.

pie chart test.png

francoiscave
Partner - Creator III
Partner - Creator III

Please see the attached file.