Skip to main content
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: 
Anonymous
Not applicable

creating pie chart choosing multiple column

Hi,

wondering do you have any suggestion creating a pie chart using multiple column without change the data structure

Having data structure like this, need to create other dashboard so can not change the structure :

Screen Shot 2018-05-05 at 15.37.41.png

Each row are each individual haveing A--G costs. and Total =sum(A:G) --Total is total cost

is there any chance can create pie chart for each individual t1, t2.....(will use filter for this so only need one pie chart)

showing the decomposition of the Total cost. So we do not need the total cost but have A:G in the same pie chart and see the %

here is the data (in the second sheet: name 'sheet 1')

Thank you.

15 Replies
Anonymous
Not applicable
Author

For Dimension part

=type

/*pick(match(type,'New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')

,'New cars'

,'Used cars'

,'Service'

,'Other Service'

,'Spare parts'

,'Bodyshop'

)

)*/

For measure part

pick(match(type,'New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')

,Sum(New cars)

,Sum(Used cars)

,Sum(Service)

,Sum(Other Service)

,Sum(Spare parts)

,Sum(Bodyshop)

)

I tried use

both file name with or with out ' ' (quotation mark) still does not work

OmarBenSalem

This not how I told u to do :

It was ValueList('New Cars',Used cars'...) etc

Please refer to my first message and try to adapt it tu ur dimensions using the ' '; in fact, we're here creating a new dimension with new values; and each value will be calculated apart.

I mean for the value New Cars for example, it will have as a measure: sum(NewCars) and so on.

Please try to adapt it and let me know

Anonymous
Not applicable
Author

HI Omar

The solution you suggested is working

I change a little bit  but have 1 question as follow (I was trying  but do not know why)

if I have a column name called 'Used car' and with a space inside

when and where should I use [Used car] when should I use 'Used car' and when should I use  Used car  (with out '', or [] mark)?

and also for same column





for dimension


=ValueList('New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')

For measure

if(ValueList('New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')='New cars', sum([New cars]),

if(ValueList('New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')='Used cars', sum([Used cars]),

if(ValueList('New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')='Service', sum([Service]),

if(ValueList('New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')='Other Service', sum([Other Service]),

if(ValueList('New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')='Spare parts', sum([Spare parts]),

if(ValueList('New cars','Used cars','Service','Other Service','Spare parts','Bodyshop')='Bodyshop', sum([Bodyshop])

))))))

Neymar_Jr
Creator II
Creator II

Hi yangcelinexu

I guess you will have to create an Island table in the script like -

Load * Inline

[

Type

'New cars',

'Used cars',

'Service',

'Other Service',

'Spare parts'

,'Bodyshop'

];

OmarBenSalem

When we write 'New Cars' with '', it means, that this is a string value we've just created.

For actual fields that exists in ur script; when the field is composed, Qlik won't recognized as one field unless u surround it by double quotes " " or brackets [ ].

Hope that was clear?

aprem
Contributor
Contributor

I tried using the same formula, I have 3 columns: each consisting of 1s & 0s.

I got the message in the graph: 

aprem_0-1676888995282.png