Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

creating a pie chart with percentages?

hi, I'm trying to create a pie chart with % - it'll need to be for just 1 quarter at a time - here's my expression but it's not working? does anyone know what I'm doing wrong?

=sum({<[Salesbook Lic Type]={'Commercial grade','Commercial downgrade'}>}([TOTAL SEATS BILLED])/Sum(total<[Fiscal Quarter and Year]> [TOTAL SEATS BILLED])'# ##0%') & ' - ' & [Upgraded From]

Thanks!

7 Replies
swuehl
MVP
MVP

Hi garriguh,

your pie chart expression should return a numerical, so I would start with

=sum({<[Salesbook Lic Type]={'Commercial grade','Commercial downgrade'}>}([TOTAL SEATS BILLED])

/ Sum(total<[Fiscal Quarter and Year]> [TOTAL SEATS BILLED])

and have a look if the numbers returned are looking ok.

This part '# ##0%') should probably be used to format the expression, but then a num() or similar is missing. And the & ' - ' & [Upgraded From] are creating a string after all, concatenating the numerical result of your division and a field value (if this works at all). So I would not use that for a chart expression if I want to calculate the Percentage in a pie chart.

Regards,

Stefan

Not applicable
Author

Thanks - it's still giving me an error in expression?

=sum({<[Salesbook Lic Type]={'Commercial grade','Commercial downgrade'}>}([TOTAL SEATS BILLED])/ Sum(total<[Fiscal Quarter and Year]> [TOTAL SEATS BILLED])

swuehl
MVP
MVP

I think there is an opening bracket too many (just before the first TOTAL SEATS BILLED)

try:

=sum({<[Salesbook Lic Type]={'Commercial grade','Commercial downgrade'}>} [TOTAL SEATS BILLED])

/ Sum(total<[Fiscal Quarter and Year]> [TOTAL SEATS BILLED])

Not applicable
Author

thank you - I almost had that one ;>  The format is close, it's showing the % label but I need it to also show the label for the slice from field [upgraded from]

swuehl
MVP
MVP

Is this field ([upgraded from]) your dimension? I think it should be part of the pop up then and could also be shown  as legend.

I'm not quite sure how to show the dimension values as values in the pie chart itself.

jduenyas
Specialist
Specialist

You expression is wrong. Try this:

=sum({<[Salesbook Lic Type]={'Commercial grade','Commercial downgrade'}>}([TOTAL SEATS BILLED])/(Sum(total<[Fiscal Quarter and Year]> [TOTAL SEATS BILLED]) - [Upgraded From])

(I assume you want to subtract the [Upgraded From] from [TOTAL SEATS BILLED]. Is that correct?)

=sum({<[Salesbook Lic Type]={'Commercial grade','Commercial downgrade'}>}([TOTAL SEATS BILLED])/Sum(total<[Fiscal Quarter and Year]> [TOTAL SEATS BILLED])'# ##0%') & ' - ' & [Upgraded From]

This "& ' - ' &" is a text and cannot be included in the Sum() expression nor an expression can have literals in it when serves for calculations.

This '# ##0%' is a formatting string and needs the function Num() with it.

Not applicable
Author

Hi - the [upgraded from] is actually the dimension?  I need it to display in each slice some how?  Is that possible? i haven't been able to find a way - Thank you