Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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.

1 Solution

Accepted Solutions
sunny_talwar

This time the color expression was incorrect... try with this

if($(vAttend) > 0.95, red(), blue())

Capture.PNG

View solution in original post

44 Replies
sergio0592
Specialist III
Specialist III

I'have tried and it works with color expression in bar chart:

=if($(V_attend)<0.95, Lightblue(), LightRed())

Is it that you're trying to achieve?

Anil_Babu_Samineni

Hello,

Hext decimal codes won't work with in the qlikview. You must use the default functions or RGB colors

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
joshrussin
Creator III
Creator III
Author

It is what I am trying to achieve but still isn't working.

joshrussin
Creator III
Creator III
Author

Oh, gotcha. I tried the lightblue() and lightred() as instructed above and still could not receive any color. Thanks!

vishsaggi
Champion III
Champion III

Can you share that sample file your are trying this?

joshrussin
Creator III
Creator III
Author

Data:

Dimension: Area_Emp

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

I am subtracting two to show the 3rd because that is the latest work day for this demo.

variable added via "variables" tab

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

Appearance:

Expression: =if ((vAttend) > 0.95, red(), blue())

attend.PNG

attend_chart.PNG

vishsaggi
Champion III
Champion III

Try like this?

Expression: =if ($(=vAttend) > 0.95, red(), blue())


If not you have share the sample data as a table it takes time to create a table typing all the relevant field values. Paste your data as a table or upload your sample qvw file please to quickly look into it.

joshrussin
Creator III
Creator III
Author

That did not work either. Here is the file. the chart is in the "daily summary" sheet

vishsaggi
Champion III
Champion III

Is this a Qliksense app?