Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
Pragya
Creator
Creator

Label and data value together in a pie chart

Hi All, 

I  have a donut chart and the labels are male and female. Now the data values are coming inside the donut chart and the labels are outside the donut chart. Is there any way i can put data values under the label. So i am looking for Female(22.11K) and Male(37.47K)

Pragya_0-1659479257742.png

Thanks

Labels (1)
  • Chart

1 Solution

Accepted Solutions
anthonyj
Creator III
Creator III

Okay, so I put this in Qlik Cloud using the standard Pie Chart.

Dummy Data:

Gender:
load * Inline [
Gender, Column
Female, 22000
Female, 1100
Male, 37000
Male, 400
Male, 200

];

Dimension: Slice

=dual(Gender & ' ' & num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K')
& ' (' & num(AGGR(Count(distinct[Column] ),Gender)/AGGR(COUNT(total DISTINCT [Column]), Gender),'#0.0%') & ')',
num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K') )

Measure: Angle

Count(distinct Column)

Appearance > Presentation > Donut Chart

Value Labels Off

Custom > None

These are the only steps I took in creating the below chart.

anthonyj_0-1659497417816.png

 

You could try simplifying down to just the Dimension and the amount and break it down.

=dual(Gender & ' ' & num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K')
,num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K') )

I did notice when I copied and pasted the above into the dimension that if it wasn't on the top line it would add an extra "=" sign which caused the same error you saw above. 

Let me know how you go.

Thanks

Anthony

View solution in original post

11 Replies
Frank_S
Support
Support

Sorry but i checked everything in my app and in the help pages for the latest version. 

That level of dimension/expression presentation customization does not appear to be available.

You can submit your idea here however. Ideas | Qlik Community

 

Kind regards...

 

Please remember hit the 'Like' button and make helpful answers as 'Solution Accepted'... Cheers!
anthonyj
Creator III
Creator III

Hi @Pragya ,

This reminded me of something I saw in one of Patric Nordstrom's Top 10 Viz Tips Part VI (Embedded Labels)

https://community.qlik.com/t5/Qlik-Product-Innovation-Blog/Let-s-Make-New-Charts-with-Qlik-Sense/ba-...

In this he did it it with a slope graph but I managed to get the same effect by amending the dimension.

anthonyj_0-1659481620035.png

To achieve this, instead of only using the column name in the dimension I used the below formula.

=dual(Gender & ' ' & num(aggr(sum(Value),Gender),'###,###') & ' (' & num(aggr(sum(Value),Gender)/aggr(sum(total Value),Gender),'##.#%') & ')'

, num(aggr(sum(Value),Gender),'###,###'))

The bold section creates the percentage share in the brackets. Go into the presentation and turn off the Value Labels.

I hope this helps.

Regards

Anthony

Pragya
Creator
Creator
Author

Hi AnthonyJ, 

I tried and i am getting the pie chart like this

Pragya_0-1659484236680.png

 

Am i able to remove the original dimension labels.

My expression is:

dual(Gender & ' ' & num(Count(distinct[Column] )/1000,'#,###K')
& ' (' & num(Count(distinct[Column] )/sum(total Aggr(COUNT(DISTINCT School),[Column])),'#0.0%') & ')',
Count(distinct[Column]))

 

 

anthonyj
Creator III
Creator III

Hi,

By the looks of the chart the value is in the middle and dimension is on the outside. It looks like you've added the expression to the measure. (I may be wrong). The DUAL function code goes on the Dimension instead of the Measure. The fact that your counts aren't wrapped in the Aggr() function would cause an error if placed in a dimension.  Try this.

Dimension:

dual(Gender & ' ' & num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K')
& ' (' & num(AGGR(Count(distinct[Column] ),Gender)/AGGR(COUNT(total DISTINCT [Column]), Gender),'#0.0%') & ')',
num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K') )

Measure:

Count(distinct [Column])

Doing it this way, The Dimension values will include the counts and percentages and you won't need to turn them off. You will, however be able to the Presentation section and turn off Value Labels.

I noticed that you added a count of school as the denominator for the percentage however I think this is going to cause incorrect values. I see your percentages of the two sections don't add up to 100%. The calculation for percentages over the dimension column needs to be in the format of count(distinct Column) / count(TOTAL distinct Column).

I hope this helps clear things up. If not let me know.

Thanks

Anthony

Pragya
Creator
Creator
Author

Hi Anthonyj,  

Thanks for your reply. 

i tried putting the formula in dimension and i got this message

Dimension:

dual(Gender & ' ' & num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K')
& ' (' & num(AGGR(Count(distinct[Column] ),Gender)/AGGR(COUNT(total DISTINCT [Column]), Gender),'#0.0%') & ')',
num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K') )

Measure:

Count(distinct [Column])

 

I got his error message

Pragya_0-1659487166760.png

 

Pragya
Creator
Creator
Author

When i do opposite

Dimension

Gender

Measure 

dual(Gender & ' ' & num(AGGR(Count(distinct[Column] ),Gender)/1000,'#,###K')
& ' (' & num(AGGR(Count(distinct[Column] ),Gender)/Aggr(COUNT(total DISTINCT [Column]), Gender),'#0.0%') & ')',
Count(distinct[Column]))

I get this donut chart

Pragya_1-1659487329388.png

 

anthonyj
Creator III
Creator III

That's weird because when I copy and paste the code that you said gets the error into my Dimension and only have count(Distinct Column).

anthonyj_0-1659488096385.png

 

anthonyj
Creator III
Creator III

anthonyj_1-1659488666470.pnganthonyj_2-1659488693511.png

 

Pragya
Creator
Creator
Author

 

 

I am working on Qlik Cloud. Is that the difference. 

Pragya_0-1659493084147.png

Pragya_1-1659493127758.png

Pragya_2-1659493146908.png