Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
spividori
Specialist
Specialist

Pie chart dimensions

In a pie chart I need to separate the average monthly sales as follows:

> 1000

> 500 and <= 1000

> 0 and <= 500

As shown in the image in the attachment qvw

Regards.

7 Replies
wms_manis
Partner
Partner

you can use a calculated dimension.

=if((Cant >0 and Cant <= 500),'0-500',

   if((Cant > 500 and Cant <=1000),'501-1000','>1000'))

Class() may work as well. 

With the data you provided, the pie would not calculate because of negative numbers. 

I used a set expression to overcome that issue.

sum( { $<Cant= {">0"}  >} Cant )

Wade

serviambi.com

kmcgovern1
Creator
Creator

I put something together quickly that uses a calculated dimension to generate the thresholds used in the pie chart.  Please see the attached document.

shaik_basha
Creator III
Creator III

Dear Sandro,

   

     Please check and let me know .

Thanks

spividori
Specialist
Specialist
Author

Hi.

Your answer works perfect, but I need to separate the monthly average.

Example:

If(Sum(Cant)/3<=500,'0-500',If(Sum(Cant)/3<=1000,'500-1000',If(Sum(Cant)/3>=1000,'>1000')))

and this fails.

Regards.

shaik_basha
Creator III
Creator III

Sorry ,

     Please check the attachment of qvw.

spividori
Specialist
Specialist
Author

Hi shaik

Your example is empty.

Regards.

kmcgovern1
Creator
Creator

It may make sense to build this dimension in the script using the group by function.  I think the issue you're seeing is that when you try to use Sum(Cant) in the calculated dimension, it doesn't know what group of records needs to be summed.  Try something like what I did in the script of the attached doc.  One thing to note, is that I'm not sure what field you're trying to sum for, so you may need to change the producto fields in the attached script.  At the very least this should give you a starting point to work from.