Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: 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
joshrussin
Creator III
Creator III
Author

The app you sent is working correctly. I have in my app the exact info and it is just red. I could re-attach a new file if needed.

passionate
Specialist
Specialist

Hi Vishwarath,

This might sound silly but, how are you trying to open th Qvf file.

You are Pasting it to Documents folder Right?

%Userdata%\Documents\Qlik\Sense\Apps

Regards,

Pankaj

passionate
Specialist
Specialist

Because it's working

sunny_talwar

Sure, go ahead

joshrussin
Creator III
Creator III
Author

thanks

sunny_talwar

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

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

Capture.PNG

vishsaggi
Champion III
Champion III

Oh ok. Got it now. Thanks Pankaj.

vishsaggi
Champion III
Champion III

It works at my end too. Just followed Sunny's message of removing "=" from the varible definition.

joshrussin
Creator III
Creator III
Author

Ok, so I got that working yesterday, and today when I updated the data, it changed back to solid colors. Any idea what's going on?

sunny_talwar

Are you defining your vAttend in the script?