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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a pie chart

I have never worked with using pie charts before and I can't seem to find a lot of information about them.  Can someone point me in the right direction on finding some information????

I want to create a pie chart that uses a field that contains a value for number of days purchased in advanced.  The field is called Advance Ticketing.  I have another field that contains number of tickets issued; call this Tickets Issued.

I want the pie chart to reflect the following:

0 - 6 days

7 - 13 days

14+ days

So each of these would have a percentage of how many tickets were issued for each category.

What I'm not sure of is how to set the dimension to reflect the three different categories I want to report on?????

Do I use the dimension limits in some way to set these categories up????

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Create a calculated dimension:

=if( AdvancedPurchasedField < 7, dual( '0 - 6 days', 6),

     if( AdvancedPurchasedField < 14, dual( '7 - 13 days', 13), dual('14+ days', 14)

     )

   )

and as expression:

=sum(TicketsIssuedField)

You can also enable relative option on expression tab.

View solution in original post

10 Replies
swuehl
MVP
MVP

Create a calculated dimension:

=if( AdvancedPurchasedField < 7, dual( '0 - 6 days', 6),

     if( AdvancedPurchasedField < 14, dual( '7 - 13 days', 13), dual('14+ days', 14)

     )

   )

and as expression:

=sum(TicketsIssuedField)

You can also enable relative option on expression tab.

MarcoWedel

Hi,

another solution could be to precalculate the buckets (depending on your table size this might improve your application performance):

QlikCommunity_Thread_166648_Pic1.JPG

QlikCommunity_Thread_166648_Pic2.JPG

tabTickets:

LOAD RecNo() as ID,

    Floor(Rand()*21) as [Advance Ticketing],

    Ceil(Rand()*10) as [Tickets Issued]

AutoGenerate 100;

tabAdvTickClass:

LOAD *, AutoNumberHash128(RangeMin, RangeMax) as %ClassID;

LOAD RangeMin, Alt(Peek(RangeMin)-1, Dual('∞', 100000000000000)) as RangeMax

Inline [

RangeMin

14

7

0

];

tabIntMat:

IntervalMatch ([Advance Ticketing])

LOAD RangeMin, RangeMax

Resident tabAdvTickClass;

Left Join (tabTickets)

LOAD [Advance Ticketing],

    Dual(RangeMin&' - '&RangeMax&' days', RangeMin) as [Advance Ticketing Class],

    AutoNumberHash128(RangeMin, RangeMax) as %ClassID

Resident tabIntMat;

DROP Tables tabIntMat;

hope this helps

regards

Marco

Not applicable
Author

understand the calculated dimension but not sure about the expression.

I would want the percentage of each category to be divided by the total tickets issued.

for example:

let's say the total number of advanced for 0 - 6 has 20 tickets and the total issued altogether is 170 so 0 -6 would show 12%, 7-13 has 50 tickets so it would be 50/170 for 29%, etc.

so the expression would have to be the sum of the category / sum(ticketsissuedfield)

how would that expression look????

swuehl
MVP
MVP

=sum(ticketsissuedfield) / sum(total ticketsissuedfield)

The TOTAL qualifier should do the magic of summing all tickets across dimensions.

Not applicable
Author

I get a 100% for each category if I do that

swuehl
MVP
MVP

Does

=sum(ticketsissuedfield)


correctly return the ticket number for each bucket?

Not applicable
Author

if I do sum(ticketissuedfield) i get 20,300%, 26,900%, & 19,300%

MarcoWedel

did you try setting the expression to "relative":

QlikCommunity_Thread_166648_Pic3.JPG

QlikCommunity_Thread_166648_Pic1.JPG

hope this helps

regards

Marco

Not applicable
Author

yes, that's what I was missing.

thanks