Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show the max date with different color in charts?

Hi,

I am trying to show the max quarter(date) with a different color in my bar chart. But, I am new to Qlik Sense scripting and I unfortunately i could find no way. Does anybody know how to do that? I my model, i could only show the selected quarter with different color. But, by default i would like to show the max quarter with red color. I also still want to keep the preexisting functionality (When any other quarter is selected it should show the selected one with different color). You could find the screenshot below:

The color expression I use is like this:

if(getselectedcount(Dönem)>0,if(isnull(only(Dönem)),rgb(16,26,42),rgb(239,38,54)),if(isnull(only(Dönem)),rgb(239,38,54),rgb(16,26,42)))

Thanks a lot in advance.

Best Regards,

Oytun

qlik com.png

1 Solution

Accepted Solutions
sunny_talwar

Sorry, I made a slight mistake... try this:

If(GetSelectedCount(Donem) = 0, If(Donem = MaxString(TOTAL Donem), RGB(239, 38, 54)), If(IsNull(Only(Dönem)), RGB(16,26,42), RGB(239,38,54)))

View solution in original post

9 Replies
sunny_talwar

May be something like this (Assuming Donem is the quarter field here)

If(GetSelectedCount(Donem) = 0, If(Donem = MaxString(Donem), RGB(239, 38, 54)), If(IsNull(Only(Dönem)), RGB(16,26,42), RGB(239,38,54)))

Not applicable
Author

Hi Sunny,

Thanks a lot for your reply. I tried the formula you suggest but unfortunately I get the screenshot below

By the way, i only used that expression for the first bar chart and it all become red.

reply.png

sunny_talwar

Sorry, I made a slight mistake... try this:

If(GetSelectedCount(Donem) = 0, If(Donem = MaxString(TOTAL Donem), RGB(239, 38, 54)), If(IsNull(Only(Dönem)), RGB(16,26,42), RGB(239,38,54)))

Not applicable
Author

Hi again,

This time, when i use your second formula, I get the screenshot below

reply2.png

sunny_talwar

Can you check what you get when you put MaxString(Donem) in a KPI object? Does it give you the maximum Donem?

Not applicable
Author

Hi Sunny,

I tried again and it works great   Thanks a lot for your reponding. Yesterday, I had a mistake because I tried it without selecting the data. But, now i tried again and i get the desired result

Not applicable
Author

By the way, I would like to show that your solution is correct. But, I am new to this site and I could only mark it as helpful. How can I mark it as correct?

oknotsen
Master III
Master III

Only one answer can be marked as correct and this topic already has an answer marked as correct .

So, for future reference, don't mark an answer correct yet till you know it is .

Have a great weekend!

Onno

Qlik Community team member

May you live in interesting times!
sunny_talwar

I am glad I was able to help.

I think you did manage to figure out how to mark the correct response