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: 
hlines_usacs
Creator II
Creator II

Color by Expression - Line Chart and Pie Chart

Hello,

I have a line chart and a bar chart in which I want to use the same expression to color.

Below is the expression and a screen shot of the two charts.

Is there a reason that they pie chart colors wouldn't work?

IF([Code] = '91'

,red()

    ,IF ([Code] = '83'

    ,blue()

        ,If(

 = '84'

            ,yellow()

        ,green()

                )

        )

   )

line and pie colors.jpg

25 Replies
pradosh_thakur
Master II
Master II

please try the same expression  in the background color of the measure. it should work. for me its working.

Learning never stops.
hlines_usacs
Creator II
Creator II
Author

Does Qlik Sense have "background colors of measures?"

shraddha_g
Partner - Master III
Partner - Master III

Background color of measure is available in Table

ishanbhatt
Creator II
Creator II

Hi,

Might be this is possible because you match the values as a string. You wrote the values in a single quote. Remove that quote and it'll work for you.

F([Code] = 91

,red()

    ,IF ([Code] = 83

    ,blue()

        ,If(

 = 84

            ,yellow()

        ,green()

                )

        )

   )

Also, See the Code values which you compare.

Thanks,

Ishan

hlines_usacs
Creator II
Creator II
Author

That field is a string field. Some of the values in that field have letters. The ones I am displaying do not, but other values do.

With that, I have tried both ways (with single quotes and without them) multiple times.

shraddha_g
Partner - Master III
Partner - Master III

try instead of '='

use wildmatch() everywhere.

For ex:

IF(wildmatch([Code] ,'91'),

,red()

    ,IF (wildmatch([Code], 83),

    ,blue()

        ,If(wildmatch(

, 84),

            ,yellow()

        ,green()

                )

        )

   )