Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
DGAL1
Contributor III
Contributor III

BAR CHART COLORING

How do i color a bar chart with my colors under the chart by expression?

This is my code , but it's not affecting the red and blue for 2023 and 2024

=if(year(Date) = 2023, RGB(255,0,0), // Red for 2022
if(Year(Date) = 2024, RGB(0,0,255))) // Blue for 2023.

The below is my bar chart , thanks

DGAL1_0-1709531759280.png

 

Labels (2)
1 Solution

Accepted Solutions
steeefan
Luminary
Luminary

Try this:

 

=if(year(Max(Date)) = 2023, RGB(255,0,0), // Red for 2022
if(Year(Max(Date)) = 2024, RGB(0,0,255))) // Blue for 2023.

 

Works for me in this demo data I have:

steeefan_0-1709532907596.png

Alternatively, you can always specify Year as master dimension and then set a color for each year:

steeefan_1-1709532995734.png

 

View solution in original post

2 Replies
steeefan
Luminary
Luminary

Try this:

 

=if(year(Max(Date)) = 2023, RGB(255,0,0), // Red for 2022
if(Year(Max(Date)) = 2024, RGB(0,0,255))) // Blue for 2023.

 

Works for me in this demo data I have:

steeefan_0-1709532907596.png

Alternatively, you can always specify Year as master dimension and then set a color for each year:

steeefan_1-1709532995734.png

 

DGAL1
Contributor III
Contributor III
Author

Thanks , the above has worked for me