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

Can a pie chart without dimension be sorted?

I have a pie chart without a dimension but only with multiple expressions.

My question is,

1. Can I sort it?

2. When I move the mouse over any slide of the pie, it only shows the label of the first expression even when it was second, third, etc. Can it be corrected?

Thank you very much in advance.

8 Replies
Anonymous
Not applicable
Author

1. You can sort them as you want - it is the order of expressions.
2. Probably not. I would simply don't show the pop-up.

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I'd rather suggest an alternative - create a virtual Dimension, showing the names of your Expressions, and a single Expression that has a condition based on the Dimension value. This way, the Pie functionality becomes more "conventional"...

Ask me about Qlik Sense Expert Class!
Not applicable
Author

Thanks Michael.

I wanted to have some sort of automatic sorting. Not manually ordering expressions.

Thanks for the reply.

Not applicable
Author

Hi Oleg,

Can you enlighten me with more details about how to create virtual Dimension?

I'm a novice and I don't know where I can find information about Virtual Dimension.

Thanks.

johnw
Champion III
Champion III

I believe the attached may be what he meant by virtual dimensions. I've also included a real dimension approach for comparison, which for at least this example is a much better solution.

I am curious what exactly you're doing with your pie chart. Pie charts are generally for showing part to whole relationships. That suggests to me that you have a whole set of something, and you're splitting it apart into subsets. The definition of these subsets could normally be represented as data, and not need to be calculated with separate expressions for each subset. Perhaps you're not splitting a whole set into subsets, but then I'm not sure why you'd be using a pie chart.

Not applicable
Author

Dear John,

I really appreciate your help.
Your example works perfect for me.

Since you mentioned that you are curious about my data, I'll describe it more. (But you already gave me a solution. So I'm not asking for more help. 🙂 )

I receive data from a company in the format as below.(The data are updated frequently. So we just want to use it without modifying it.)

-----------------------------------------------------------
[operator] [year] [quarter] [model_num] [account] [amount]
-----------------------------------------------------------

For my example, Total Maintenance$ can be represented by 4 subgroups. (Other groupings are possible depending on the functioins or objectives.)
Labor$ (Airframe Labor$, Engine Labor$): account={52251, 52252}
Material$ (Airframe Material$, Engine Material$): account={52461, 52462}
Outsource$ (Airframe Oursource$, Engine Outsource$): account={52431,52432}
Overhead$: account={52796}

So, on QlikView, I have list boxs for [operator] [year] [quarter] [model_num]. On the Pie Chart I had the following Expressions without a dimension.
Labor$: Sum ({$<account={52251, 52252}>} amount)
Material$: Sum ({$<account={52461, 52462}>} amount)
Outsource$: Sum ({$<account={52431,52432}>} amount)
Overhead$: Sum ({$<account={52796}>} amount)

And I wanted to find out how to sort the pie slices in descending order.
This example only has 4 slices, but sometimes I have to have a Pie Chart with more than 10 slices. (Well, there are 300 account numbers in the data.)

Thanks to your example, my life got a lot easier.

I appreciate it.

Best regards,

Eddie

johnw
Champion III
Champion III

OK, thank you - your original question now makes sense to me, and I'm glad I was able to stumble onto the correct answer even though I didn't really understand what you were asking.

I gather you already figured this out and are now doing it, but just in case, I'd handle this with real dimensions instead of multiple expressions. Something like this, maybe:

[Cost Groups]:
LOAD
subfield("group",' - ',1) as "cost group"
,subfield("group",' - ',2) as "cost subgroup"
,subfield("accounts",',') as "account"
INLINE [
group: accounts
Maintenance - Labor: 52251, 52252
Maintenance - Material: 52461, 52462
Maintenance - Outsource: 52431, 52432
Maintenance - Overhead: 52796
etc. for other cost groups
] (delimiter is ':');

Trellis pie chart:
Dimension 1 = "cost group"
Dimension 2 = "cost subgroup"
Expression = sum(amount)

Hmmm, while doing it trellis style is easier, that might not make sense in your application. If you wanted a separate pie chart for maintenance, you could do it one of these ways:

approach 1 - calculated dimension:
Dimension = if("cost group"='Maintenance',"cost subgroup")
Expression = sum(amount)

approach 2 - set analysis:
Dimension = "cost subgroup"
Expression = sum({<"cost group"={'Maintenance'}>} amount)

It's too tempting to see if this all works. Well, after some debugging, sort of. I can't seem to get the sort working correctly in the trellis chart, which was kind of the whole point of this exercise. I left some of my attempts in there commented out. Maybe someone else can figure it out. I don't know whether the calculated dimension or set analysis approach would be faster in this case. You might test if there are any performance issues.

It might also be easier to maintain your groups and sub groups in Excel or something, so that you were just changing a data source instead of changing and reinstalling the script, but I doubt these groups change frequently.

Sorry, I know you weren't asking for more help. I just think this is an interesting problem, so I couldn't stop myself from poking at it. 🙂

Not applicable
Author

Dear John again,

Thank you very much for taking some more time to help me. This example is superb! It really looks a lot better to handle it with real dimensions instead of multiple expressions. I wouldn't have figured it out by myself.

Thanks for enlightening me again and showing me what to do. I'm glad that you didn't resist yourself from poking at it. 🙂

Eddie