Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ritaaguiar
Creator
Creator

Pie Chart with Sum of the Count of some data values in one color and the rest in another color

Hello,

 

I have a Data file which includes the occurrence of several different values. I want to group some of those values to be displayed all together in the same pie sector, while the remaining would be displayed as the leftover sector of the pie chart.

Simplified Example:

'Command' values can be: LAYER, PEDIT, 3DORBIT, EXTRUDE.

 

I want LAYER, PEDIT to be displayed in the color blue and in percentage (e.g. 76%).

 

I want the remaining values (which are basicaly 3DORBIT, EXTRUDE) to be displayed in the color red and in percentage (remaining 24%).

 

Qlik Sense 61.png

 

I have tried:

 

If(Command = 'LAYER' OR Comando = 'PEDIT', Count(Command), Count(Comando))

However, it does not distinguish between the first group LAYER and PEDIT from the remaining.

 

Then I added this to the colors and legend expression:

if([Comando]='LAYER' OR [Comando]='PEDIT', blue(), red())

 

Qlik Sense 62.png

 

Which is pretty close to what I want. However, I want the chart to Sum the percentages in blue and to Sum the percentages in red.

 

How can I do this?

 

Many thanks

 

Labels (1)
1 Solution

Accepted Solutions
zhadrakas
Specialist II
Specialist II

Channas Solutions seems good for me:
Dimension: =if(match(Command, 'PEDIT', 'LAYER'), 'BLUE', 'RED')
Expression: count(Command)

Alternatively you could calculation that in script too:
like:
if(match(Command, 'PEDIT', 'LAYER'), 'BLUE', 'RED') as Command_Segment

then use
Dimension: Command_Segment
Expression: count(Command)

View solution in original post

6 Replies
Channa
Specialist III
Specialist III

hi instead of measure try to have calculated dimension

 

If(Command = 'LAYER' OR Comando = 'PEDIT', 'PEDIT', 'other')

Channa
ritaaguiar
Creator
Creator
Author

@Channa 

 

Sorry, what do you mean?

I don't think I understood.

 

do you mean to put 'LAYER' and 'PEDIT' all inside the pie sector 'PEDIT' while the remaining commands are inside a pie sector namer 'other'? (I changed other to 'EDIT' because there isn't actually any command with the name 'other')

I just tried it, but it doesn't work 😕

Qlik Sense 63.png

 

Qlik Sense 64.png

 

Channa
Specialist III
Specialist III

Count(Command)

this need to be ur measure

Channa
ritaaguiar
Creator
Creator
Author

@Channa 

Yes. That's what I have been using.

I just don't know how to group the data of several values.

 

I want a pie chart with two sectors:

PEDIT + LAYER = 23.6 + 6.4 = 30% group sector of the pie chart

While the remaining commands are displayed in a sector with 70%

ritaaguiar
Creator
Creator
Author

@Channa 

 

I have tried using the following on 'Measures':

 

Sum(aggr(Count([Comando] = 'PEDIT'), Count([Comando] = 'LAYER')))

 

However, it doesn't work at all and I get:

Qlik Sense 65.png

zhadrakas
Specialist II
Specialist II

Channas Solutions seems good for me:
Dimension: =if(match(Command, 'PEDIT', 'LAYER'), 'BLUE', 'RED')
Expression: count(Command)

Alternatively you could calculation that in script too:
like:
if(match(Command, 'PEDIT', 'LAYER'), 'BLUE', 'RED') as Command_Segment

then use
Dimension: Command_Segment
Expression: count(Command)