Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pie chart and cyclic group

Hi,

Based on a simple table like this:

Year, Value1, Value2

2010, 1, 4

2011, 2, 5

2012, 3, 6


Is it possible to create a pie chart that shows the relationship between value1 and value2 for a year, and then cycle the years with a cyclic group? I guess the first question is if it is possible to use cyclic groups for rows rather than columns.

If I transpose the table I can create the cyclic group, but then how do I write the expression to show the both values (now rows) in the pie chart?

All replies are appreciated!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Hmm, I guess I did forget. Attached now.


talk is cheap, supply exceeds demand

View solution in original post

9 Replies
Gysbert_Wassenaar

You can use an expression group if you create three expressions, one for each year. But why not add the Year field to a listbox and let users select the year in there. You could set the listbox to Always One Selected Value so that a user can select only one year at a time.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you for your rapid reply.


The listbox would take up more space (tight design), but I can make it work. I tried it, but can't seem to get the expression right. Could you please show me how to do it? Also, it would be very interesting to see an example of your expression group solution .


I have attached a test document.

Gysbert_Wassenaar

See attached example. And if you think a listbox is taking up too much space then get rid of the pie charts and use for example bar charts or inline charts in a straigth table that take up far less space.


talk is cheap, supply exceeds demand
effinty2112
Master
Master

If I understand you right you want to have a pie chart showing the ratio of Value1 to Value2 for each year. If so you need to re-organise your data in the load statement like this:

Data:

LOAD * INLINE [

    Year, Value1, Value2

    2010, 1, 4

    2011, 2, 5

    2012, 3, 6

];

CrossData:

CrossTable(Dim, Values)

LOAD

*

Resident Data;

Drop table Data;

Turning

Year, Value1, Value2

    2010, 1, 4

    2011, 2, 5

    2012, 3, 6

into

Year Dim Values
2010Value11
2010Value24
2011Value12
2011Value25
2012Value13
2012Value26

The labels don't make much sense here.

Now you can make your pie chart.

Not applicable
Author

Thank you for the advice. I can't find any examples in your previous post though, did you forget to attach it?

effinty2112
Master
Master

Hi Hakon,

Please find attachment. I hope I've understood what you are wanting, if not let me know.

Cheers

Andrew

Gysbert_Wassenaar

Hmm, I guess I did forget. Attached now.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you, great examples!

Not applicable
Author

Thank you for your reply Andrew! Great tip, a crosstable was indeed the solution to my problems (combined with Gysbert's expression groups).