Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Negative in Pie Chart

Hi,

It is possible to put in a Pie Chart Positive and Negative values in the same chart?????

I need Help with this plz

Regards

Carlos

26 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

No, I don't think this is possible.

johnw
Champion III
Champion III

How could you even display them? What does a negative slice of pie look like? I think you need a different way of displaying your data if you have both positive and negative values.

Not applicable
Author

i was thinking that for example, when you use two dimensions in chart Pie the second dimension appear on the first dimension with smaller slice than the first one, for that reason i thinked it could be possible.

johnw
Champion III
Champion III

Hmmm, now that you mention it, I suppose that WOULD be a way to show negatives. And I bet you could fake it up like that. For instance, add a calculated dimension with values 'Positive' and 'Negative', and assign it based on the values aggregated by the other dimension. Might need to change the negatives to positive, but you might not. I still think you could make it look better with another type of chart, but it probably COULD be made to work in a pie chart.

johnw
Champion III
Champion III

Well, it turns out that I HATE the way it looks, but here's kind of what I was thinking...

GAH! Can't attach a file with the new forum.

OK, here's my script:

LOAD
'Company ' & recno() as Customer
,101 - ceil(rand()*201) as Sales
AUTOGENERATE 10
;

Pie chart dimensions are:

  1. =if(aggr(sum(Sales),Customer)<0,'Negative','Positive')
  2. Customer

And expression is:

fabs(sum(Sales))

I hate it, but there's one answer.

Not applicable
Author

Hi John, I saw your answer and i putted in my app, i have a question maybe you can help me, i need to put on my application two filters of month and other two filters of year but they have two work independent of each other, do you have an idea to do this plz i need some help with this, i have 2 days now trying to do this my head isnt strong enough.

Regards

Carlos

johnw
Champion III
Champion III

Well, the simple answer is that you can't have two independent filters for the same data at the same time. But what are you trying to do with your two independent selections? Compare two different time periods in one chart? Like select January 2009 in one filter, February 2010 in the other filter, and compare the sales for both months? Then have a year month field, select both of those, then have a chart with the year month as a dimension. Or create a couple of variables that the user sets. Then in your chart, use set analysis or an if() to match up your real fields to the "selected" values in the variables. Just examples though. I'd need to know what you're trying to accomplish to give more relevant advice.

Not applicable
Author

Thank you John, what they want to see are the sales in the both periods of time, i have in my app a simple table chart with the sales and they want to see the sum of the sales in both periods of time. For example:

Sales in January 2009

+

Sales in February 2010

and it would be the same for a stack bar chart.

johnw
Champion III
Champion III

If that's the requirement, then I think all you need is a year month field. If you have sum(Sales) in a table, and they select both January 2009 and Feburary 2010, then the table will show sales in January 2009 + sales in February 2010. If you make a stacked bar chart, where year month is the dimension being stacked, then the two segments in the bar will be January 2009 and February 2010.

So maybe all you needed for the two selections to be "independent" is a year month field?

As far as the definition for the year month field, I always make it an actual date, the first day of the month. That makes things convenient since you can use all the date functions on it. So...

date(monthstart(Date),'MMM YYYY') as "Year Month"