Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Pie Chart with combined columns

Hey there

In Qlik Sense I like to create a pie Chart with different areas.

I've two different tables with different column names but with same content.

It's not possible to rename the columns to the same name.

table1

has the fieldname name1 with the values: "OK", "NOK"

table2

has the fieldname name2 with the values: "OK", "NOK"

How can I make a pice chart, witch count's each OK and NOK?

I like to combine somehow the column name1 and name2 two one column only for createing the pie chart.

Thanks & Regards

Sarah

Tags (2)
5 Replies
Employee
Employee

Re: Pie Chart with combined columns

Hi Sarah,

The only solution I could come up with was to combine the two fields into a third field.  Note this doesn't preclude you from also have the fields separate.  Please see attached and below for the QVF and load script I used.

-Josh

Qlik

Table1:

LOAD

    Key,

    Field1

FROM [lib://Desktop/Data.xlsx]

(ooxml, embedded labels, table is Sheet1);

Table2:

LOAD

    Key,

    Field2

FROM [lib://Desktop/Data.xlsx]

(ooxml, embedded labels, table is Sheet2);

Table3:

Load

Key,

Field1 as Field3

Resident Table1;

Concatenate(Table3)

Load

Key,

Field2 as Field3

Resident Table2;

Not applicable

Re: Pie Chart with combined columns

Good morning Josh

Thank you for your quick response.

It sounds for me as a workaround.

I've exptected a great function which can do this...

Does anybody know another solution?

Thanks & Regards

Sarah

prabhuappu
Contributor II

Re: Pie Chart with combined columns

hi,

you can use value list function as below,

valuelist('ok','nok') as dimension

and in expression

if(<same value list function>='ok', count({<name1={'ok'}>} name1) + count({<name2={'ok'}>} name2) , count({<name1={'nok'}>} name1) + count({<name2={'nok'}>} name2) )

if anyone knows better option please share it....

regards,

Prabhu appu

Not applicable

Re: Pie Chart with combined columns

Hey Prabhu

Your suggestion sounds intressting.

The part with "same value list function" I don't understand.

Can you please explain it more, or make a real example?

You could use the Test.qvf from Josh.

Regards

Sarah

prabhuappu
Contributor II

Re: Pie Chart with combined columns

The function will be something like below,

if(ValueList('OK', 'NOK')='OK', Count({<name1={'OK'}>}Key1)+Count({<name2={'OK'}>}Key2),

if(ValueList('OK', 'NOK')='NOK', Count({<name1={'NOK'}>}Key1)+Count({<name2={'NOK'}>}Key2)

))

There are some drawbacks in this if the Values in the name1 and name2 field changes dynamically (where as here only two <OK and NOK>) then  this is difficult to achieve.

Regards,

Prabhu Appu

Community Browser