Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
drromanos
New Contributor III

Pie chart and Scripting

Hi Guys!!

I am not sure if I am posting in the correct section but I ll give it a try.

I have a bit of a problem with a task I have been assigned to. I have to produce a pie chart with some values in it but I have problem with the scripting bit at the mo. basically I have an excel sheet with two extensive tables and I need to use the data from those tables to create the chart. The first table is called Priority and the second table is called Product Condition. (See image below)

examples.JPG

Now all the fields in these tables are associated with each other, hence we can have a Good product which can be Essential, Desirable or Nice to have. Same rule applies for the rest of the fields.

My task is to create a pie chart which should include the total amount of Essential (the %), Desirable and Nice to Have as expressions. This is something i have managed to do. My problem is that i need to add 3 more expressions which should be number of Essential not equal to Good, number of Desirable not equal to Good and Nice to Have not equal to Good. Any ideas how to make that?????

The scripting I’ve used for the first 3 Expressions is as follows.....  

(100 * Count({$<[Priority] = {"Essential"}>} GeneralDock)/ Count({$<[Priority] = >} GeneralDock) )

(100 * Count({$<[Priority] = {"Desirable"}>} GeneralDock)/ Count({$<[Priority] = >} GeneralDock) )

(100 * Count({$<[Priority] = {"Nice to have"}>} GeneralDock)/ Count({$<[Priority] = >} GeneralDock) )

The result of these scripts is shown in the image below

example2.JPG

Thanks in advance

1 Solution

Accepted Solutions
drromanos
New Contributor III

Re: Pie chart and Scripting

The only problem i get is with the -={Good}

it doesent like the first bracket for some reason giving me "Error in set modifier expression"

Thanks for the reply BTW

3 Replies

Re: Pie chart and Scripting

You need to add the extra condition [Product Condition] -= {"Good"} into your current expressions.  The minus before the equals is what give the not equal


So you should get something like the below, I have just typed it freehand without testing so bear with me if it has typo.


(100 * Count({$<[Priority] = {"Essential"} , [Product Condition] -= {"Good"}>} GeneralDock)/ Count({$<[Priority] = >} GeneralDock) )

drromanos
New Contributor III

Re: Pie chart and Scripting

The only problem i get is with the -={Good}

it doesent like the first bracket for some reason giving me "Error in set modifier expression"

Thanks for the reply BTW

Re: Pie chart and Scripting

The expression editor has a bug that causes it to flag the -= construction as wrong. But it is in fact correct and will work. It's possible there's another editor. You can double-check your expression and if necessary test each modifier condition separately to find out which one is causing the error.


talk is cheap, supply exceeds demand
Community Browser