Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
dreweezy
Creator II
Creator II

color by expression not properly working

Iv got a scatter plot and trying to color by expression. 

X axis = Revenue

Y axis = Cost

Dimension = Accounts

My expression seems to be working to an extend to where if revenue is equal to cost, make it green, else make it red.

The problem is I see a lot of cases on my scatter plot where indeed revenue = cost but the color is still showing red. 

Expression:           If([Sales] = [Revenue], Green(), red())

Any ideas on why this may be? Is this a bug you guys think?

Labels (1)
6 Replies
deborahs
Contributor III
Contributor III

Looks good to me! 

Can you try this?

if(((num(Sales)=num(Revenue)),green(), red());

dreweezy
Creator II
Creator II
Author

Thanks, I've tried that but still no luck. I brought in a table to see if it was a rounding issue, but these 2 measures indeed have the exact same number. 

deborahs
Contributor III
Contributor III

Strange, I have a similar expression in one of our apps and it works fine.

That one is:

if(sum(Table.FieldName)<0,Red()).

Yours looks good to me, idk why it gives you error!

dreweezy
Creator II
Creator II
Author

Not sure why that is. Trying some other workarounds - hopefully I can find a solution here soon. 

dreweezy
Creator II
Creator II
Author

Very weird behavior but I restarted Qlik Sense and it seems to be working now.

deborahs
Contributor III
Contributor III

Oh! That's strange! 

Although you got it to work which is all that matters!