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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
swati_rastogi27
Creator
Creator

Chart colors based on calculated dimension value

Hi folks ,

This is wrt a bar chart I am looking at.

I have a calculated dimension as :

=if(EOLDate = ' ', 'Current', if(DateSelected < EOLDate, 'Current', if(DateSelected < EOVSDate, 'EOL', 'EOVS')))

The expression is :

=Count(if(EOLDate = ' ', 'Current', if(DateSelected < EOLDate, 'Current', if(DateSelected < EOVSDate, 'EOL', 'EOVS'))))

In my graph , i have 3 bars , 1 for Current , 1 for EOL and 1 for EOVS

I want these colors for the bars :

'Current' -> Green

'EOL' -> Yellow

'EOVS' -> Red

Unable to do that.

Please help

5 Replies
shraddha_g
Partner - Master III
Partner - Master III

I would suggest to create 3 Measures in Master for Current, EOL, EOVS.

There you can directly assign colors.

Else try,

if(EOLDate = ' ', red(), if(DateSelected < EOLDate, red(), if(DateSelected < EOVSDate,green(), yellow())))

swati_rastogi27
Creator
Creator
Author

This expression is not working. It assigns Yellow to all the 3 bars

if(EOLDate = ' ', red(), if(DateSelected < EOLDate, red(), if(DateSelected < EOVSDate,green(), yellow())))

balabhaskarqlik

Try this, in your Background Color area of the expression:

=if(IsNull(EOLDate) OR (DateSelected < EOLDate), Green(), if(DateSelected < EOVSDate, Yellow(), Red()))

swati_rastogi27
Creator
Creator
Author

Unfortunately this is setting all 3 bars to green

vishsaggi
Champion III
Champion III

Try this?

=if(Len(Trim(EOLDate)) = 0 OR DateSelected < EOLDate, red(), 

   if(DateSelected < EOVSDate, green(), yellow()))