Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I am having a problem in creating pie chart as per my requirements

I have simple data as shown below:

NamesMarks
A2
B3
C4
D5
E6
F7
G8
H9
I10
J11
K12
L16
M17
N20
O21
P34
Q50

Now I want to create a pie chart with 3 pies on it as: 1) Marks Less than 10

                                                                            2) Marks Between 10-20

                                                                            3) Marks Greater than 20Untitled.jpg

And show their percentages as shown. I don't know if I have to create groups or what. Please explain this in detailed manner as I am new to QlikView

13 Replies
mphekin12
Specialist
Specialist

Your script should look like this:

Main:

LOAD

  *,

  if(Mark < 10, '< 10', if(Mark < 20, '10 to 20', '> 20')) as Bucket;

LOAD * INLINE[

  Name, Mark

  A, 2

  B, 3

  C, 4

  D, 5

  E, 6

  F, 7

  G, 8

  H, 9

  I, 10

  J, 11

  K, 12

  L, 16

  M, 17

  N, 20

  O, 21

  P, 34

  Q, 50

];

In the chart properties select 'Bucket' for the Dimension.  The expression will be 'count(Bucket)'.  In the expression tab you will also want to check 'Relative' and 'Values on Data Points'.

I hope this helps!

Not applicable
Author

I ran this script. I am getting this syntax error.Capture.PNG.png

mphekin12
Specialist
Specialist

Looks like there is a space missing between INLINE and the [.  Try this:

LOAD
  *,
 
if(Mark < 10, '< 10', if(Mark < 20, '10 to 20', '> 20')) as Bucket;
LOAD * INLINE [
  Name, Mark
  A, 2
  B, 3
  C, 4
  D, 5
  E, 6
  F, 7
  G, 8
  H, 9
  I, 10
  J, 11
  K, 12
  L, 16
  M, 17
  N, 20
  O, 21
  P, 34
  Q, 50
]
;

Not applicable
Author

It worked. Thanks a lot!!!