Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
joshrussin
Creator III
Creator III

Colors by expression help.

Hey everyone,

Making a simple bar chart here and trying to get my colors by expression to work. They are still all the same color. Here is my example data.

attend.PNG

I am trying to get the table to show the percentage of employees every day based on Area_Emp.

So first I need to get Actual_Emp/FTE_Emp to get percentage, then make that either blue if below .95% or red if over .95%.

Here is the expression I am using.

Created a variable vAttend =Sum({$<Date_Emp={"$(=Date(Today()-3))"}>} (Actual_Emp / FTE_Emp))

Color expression in bar graph

if (sum(vAttend) < 0.95, '#f93f17', '#f93f17')

Currently they are all red.

44 Replies
jmvilaplanap
Specialist
Specialist

Could you use a pivot table?

In a pivot table is easy to do this, just in "Background Color" in expressions or dimensions you can define your colors and rules

Capture.PNG

sunny_talwar

This expression is showing 0 result....

Sum({$<Date_Emp={"$(=Date(Today()-2))"}>} (Actual_Emp / FTE_Emp))

Also, you have this expression for the bars

=Sum({$<Date_Emp={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}>} (Actual_Emp / FTE_Emp))

and you want to use this for color?

Sum({$<Date_Emp={"$(=Date(Today()-2))"}>} (Actual_Emp / FTE_Emp))

Anonymous
Not applicable

As a side note, you CAN use hex colors like this:


num#('FFF93F17,'(HEX)')

The FF in the beginning replaces the # symbol.


Anonymous
Not applicable

It works for me just be putting your whole expression in there instead of your variable.

if(Sum({$<Date_Emp={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}>} (Actual_Emp / FTE_Emp)) < 0.95, red(), blue())

Does that work for you? 

Anonymous
Not applicable

Actually it works for me using your variable if I copy and paste your measure expression into it.

make vAttend

Sum({$<Date_Emp={"$(=FirstWorkDate(Today()-1,1,$(vHolidays)))"}>} (Actual_Emp / FTE_Emp))