Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nezuko_kamado
Creator
Creator

pick(match()) and if() not working at Bar(Combo) charts by expression

When using color > By expression instead of Auto color at a bar chart or combo,   none of pick(match(), if(), and variable set works. 

pick(match(status,'approve','cancel'), yellow(), red())

if(status='approve', yellow(), if(status='cancel', red()))

pick(match(status,'approve','cancel'), $(vapprove), $(vcancel))

nezuko_kamado_1-1627068348794.png

I set dimension and measure as below.

nezuko_kamado_4-1627068775627.png

Count({$ <status={'approve'}>} station)

nezuko_kamado_6-1627068853380.png

Count({$ <status={'cancel'}>} station)

nezuko_kamado_7-1627068882396.png

 and the data table is 

test:
load ActionDate, if ( isnull(Project ),'Unknown', Project) as Project , Approval
Inline [ ActionDate, Project , Approval
2/4/2021, a , cancel
2/4/2021, b, approve
2/4/2021, c, approve
2/5/2021, b, cancel
2/5/2021, a, approve
2/5/2021,c,approve
2/8/2021, c, approve
2/10/2021, a, approve
2/10/2021, b, cancel
2/10/2021, c, approve
3/15/2021,a, approve
3/15/2021, c, cancel
3/16/2021, c, cancel
];

Labels (2)
1 Reply
rubenmarin

Hi, you can't give two different color to one dimension value using that expression, may-201 has both values, so when you ask for status and it has more than value it returns null(), it only returns a values when ther is only one value, that's why it only paints the first and the last bar.

For that kind of chart you don't need a combo, you can do a bar chart with month-year and approval as dimensions and just Count(Station) as measure.

If you have approval defined as master dimension you can assign colors to each value of the dimension and use dimension colors on bar chart