Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

philippe_motill
New Contributor III

Coloring a pie chart using expression

Hi all ,

I am trying to color a pie chart using the following expression :

=if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) = 1,

Yellow(),

if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) = 2,

lightblue(),

if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) = 3,

lightred(),

if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) > 3,

lightred(),

green()))))

It works when the expression = 1 , 2, 3 , but it does not work when the expression is > 3.

Any ideas ?

thanks a lot

Philippe

4 Replies
luc_lacroix
New Contributor III

Re: Coloring a pie chart using expression

Hi Philippe,

There is two lightred one for = 3 the other for > 3 try changing the second for an other color

=if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) = 1,

Yellow(),

if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) = 2,

lightblue(),

if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) = 3,

lightred(),

if (aggr(SUM({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"},FileType=>} PHASEDCALLS)-

count({<RecordType={'CALL'},FileType=,CUSTOMER_ID=p({<CUSTOMER_ID={"=sum(PHASEDCALLS) > count(DISTINCT EVENT_ID)"}>}CUSTOMER_ID)>} Distinct EVENT_ID),CUSTOMER_ID) > 3,

lightred(),

green()))))

Regards.

Luc

philippe_motill
New Contributor III

Re: Coloring a pie chart using expression

I changed the second lightred to an other color and it does not change anything.

Thanks

Philippe

shraddha_g
Honored Contributor III

Re: Coloring a pie chart using expression

can you share a sample app?

philippe_motill
New Contributor III

Re: Coloring a pie chart using expression

Unfortunatly the app is really big (more than 600mb).

I will try to create a small App.

Thanks for your help

Philippe

Community Browser