Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
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

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

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)))

9 Replies

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

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

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

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

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

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

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

Hi again,

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

reply2.png

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

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

Not applicable

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

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

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

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
Honored Contributor III

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

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!

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

I am glad I was able to help.

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