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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Single Column Pie-Chart

How would I go about Creating a pie-chart for a single column set of data.. I have two columns, one with items(Item), and another with values(price_changes) which are 0, or positive or negative. I need to create a pie chart with the sum of price changes that are 0, that are greater than 0 and price changes that are lesser than 0..

I am trying with these dimensions

=count({<Price_Changes={'=0'}>}Price_Changes)

=count({<Price_Changes={'>0'}>}Price_Changes)

=count({<Price_Changes={'<0'}>}Price_Changes)

and my Expression is Count(Item)

I keep getting an error.. Can anyone point me in the right direction?

I'm an absolute noob with qV.. Kindly be gentle..

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

You're expressions in the dimension, whether or not correct, results in the values of Price_Changes, no matter what the if condition is. In the calculated dimension you want to group the Price Change values, something like:

=if(Price_Changes=0,'Zero',if(Price_Changes>0,'Positive',if(Price_Changes<0,'Negative')))

This will create three grouped values of price change named Zero,Positive and Negative

View solution in original post

5 Replies
Not applicable
Author

Hi,

You can use if condition.

=If(Price_Changes=0,Price_Changes)

=If(Price_Changes>0,Price_Changes)

=If(Price_Changes<0,Price_Changes)

stigchel
Partner - Master
Partner - Master

You're expressions in the dimension, whether or not correct, results in the values of Price_Changes, no matter what the if condition is. In the calculated dimension you want to group the Price Change values, something like:

=if(Price_Changes=0,'Zero',if(Price_Changes>0,'Positive',if(Price_Changes<0,'Negative')))

This will create three grouped values of price change named Zero,Positive and Negative

Not applicable
Author

Hi,

You can use below code. I think it is helpful to you.

In dimension,

=if(Price_Changes=0,Price_Changes,if(Price_Changes>0,Price_Changes,if(Price_Changes<0,Price_Changes)))

In expression,

Sum(Item)  or    Count(Item)

Not applicable
Author

Thank you for explaining the logic behind it. I understand now. Thanks a ton!!

Not applicable
Author

Thank you, your solution did give me a pie chart, but it listed the no. of items with respect to their price changes. I mean the actual value..

=if(Price_Changes=0,'Zero',if(Price_Changes>0,'Positive',if(Price_Changes<0,'Negative')))

^ This worked perfectly for me though. I still want to thank you for taking the time to help me. I appreciate it a lot.