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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
keliane
Contributor III
Contributor III

How to lock the color code ?

Hi,

 

I'm using a graph that's displaying [Net Income] for the year 2024, 2023 and 2022. I've put 3 variables (v2024, v2023, v2022) and when the this variable = 0, it doesn't display the net income for this year.

The thing is, when the user want to display only 1 year and displaying multiple years after, the color code is setting automatically to '1 color'.

Any Ideas ? Thanks !

Labels (1)
1 Solution

Accepted Solutions
keliane
Contributor III
Contributor III
Author

I found hahaha it's very easy finally.

Just add a master item to your measure ! You can find it under the expression of your measure.

 

Great day all.

View solution in original post

9 Replies
justISO
Specialist
Specialist

Hi, maybe you can try 'lock' color on years, not variables, with color expression like: if(year=2024, red(), if(year=2023, green(), yellow()))

keliane
Contributor III
Contributor III
Author

Hi,

This expression is not working for me 😕

This is my expression I'm Using for Year 2024 :

Sum({<[Committed Limit]-={'Yes'},[Report Date.autoCalendar.Year]={$(=Max(Year))}>} [Exposure])
/
Count(Distinct {<[Report Date.autoCalendar.Year]={$(=Max(Year))}>} [Report Date])

Thank you !

keliane
Contributor III
Contributor III
Author

Hi,

Still didn't find out guys //

gomeri
Partner - Creator
Partner - Creator

Hi @keliane,

it is possibile that functions $(=Max(Year)) doesn't work?

Try this instead of your expression:

Sum({<[Committed Limit]-={'Yes'},[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Exposure])
/
Count(Distinct {<[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Report Date])

 

Giovanni O. D.
keliane
Contributor III
Contributor III
Author

My expression is working well, the problem is just coming from the color expression. I'm using a line chart btw, with multiple variable. Here is my full expression (that is working perfectly for the LINES) : 

If(
vShowCommited = 0,
//Show ONLY exposure for UNCommited Lines
Sum({<[Committed Limit]-={'Yes'},[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Exposure])
/
Count(Distinct {<[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Report Date])
,
If(
vShowUncommited = 0,
//Show ONLY exposure for UnCommited Lines
Sum({<[Committed Limit]-={'No'},[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Exposure])
/
Count(Distinct {<[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Report Date])
,
//Show Exposure for Commited+Uncommited
Sum({<[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Exposure])
/
Count(Distinct {<[Report Date.autoCalendar.Year]={'$(=Max(Year))'}>} [Report Date])))

 

It's working well with the option 'Mulicoloured' but when I'm displaying only 1 years (With buttons affiliated to variable) the option 'Multicoulored' change automatically to 'Sing Colour' and not coming back. So that's why I need a colour expression.

Thanks for the one who's willing to help me !

keliane
Contributor III
Contributor III
Author

I tried this expression : 

 

If(
Column(1), // For Measure 1 (Current year)
RGB(255, 0, 0), // Red for Measure 1

If(
Column(2), // For Measure 2 (Previous year)
RGB(0, 255, 0), // Green for Measure 2

If(
Column(3), // For Measure 3 (Two years ago)
RGB(0, 0, 255) // Blue for Measure 3
)))

 

And it gave me something very strange, seems like the measures are being mix together ? I join you a screenshot !

Screenshot 2024-09-05 112547.png

keliane
Contributor III
Contributor III
Author

Update : Still didn't fid the answer

keliane
Contributor III
Contributor III
Author

Still pending argghhhh

keliane
Contributor III
Contributor III
Author

I found hahaha it's very easy finally.

Just add a master item to your measure ! You can find it under the expression of your measure.

 

Great day all.