Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bruce_sorge
Contributor III
Contributor III

Basing table row color on year

Hello, I hope someone can help me out here. 

I have a spreadsheet with a column called Date Highlighted. The format is m/dd/yyyy. I have this expression:

=If(Year([Date Highlighted]) = 2021, 'green()', white())

My thinking is that if the year is 2021, then the row should be green, otherwise it's white. However, all rows are white. Can someone tell me what is wrong with my expression?

 

Thanks

Labels (2)
6 Replies
NitinK7
Specialist
Specialist

I think you passed green() in single quotes '', remove quotes and try

Or

If(Date([Date Highlighted],'YYYY') = 2021, green(), white())

bruce_sorge
Contributor III
Contributor III
Author

Thanks, neither solution worked. It's not a big deal though. Just trying to replicate my spreadsheet. 

aaron
Contributor II
Contributor II

If this formula is being passed to the field expression, it will be white. However, it should work as expected if you use it as a formula in the background color expression.

aaron_0-1621881414355.png

 

  

bruce_sorge
Contributor III
Contributor III
Author

Thanks, that is where I am passing the expression. 

aaron
Contributor II
Contributor II

😊
I was searching for articles where the entire row’s background color could be changed but could not find any. I posted the question here: https://community.qlik.com/t5/App-Development/Changing-the-row-color-in-a-table-in-Qlik-Sense/m-p/18... if you know, please let me know.
Thanks.
bruce_sorge
Contributor III
Contributor III
Author

Thanks, I subscribed to the channel. Hopefully and answer appears.