Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

Bar colors

Dear QlikView users,

I am looking for the definition, that will allow me to show recent 12 bars in different color that rest of the bars. I know I can define color, after clicking "cross" next to my expression, but I have no idea what I should put there. Anybody knows?

Maybe another idea- Could I use bar offset to show recent 12 months?

Thank you,

Beata

10 Replies
Not applicable

Bar colors

Now I'm using:

if(Max (CalendarMonth, -12),LightGreen()) but it turns all bars green;(

Not applicable

Bar colors

Hi

Try this, not tested but should work


=If(CalendarMonth < (max(CalendarMonth)-12),LightGreen(), LightRed())


Should Color the first 12 Green and all the Others Red, cahnge Colors to your needs 😉 (I prefeer Using the rgb() function becasue you're more flexible!)

Edit:
Here a suggestion for Baroffset (looks nice in Combination with the Colors)

Just paste in the "Baroffset" Part:


=If(CalendarMonth < (max(CalendarMonth)-12),1,0)


Greets

Not applicable

Bar colors

I accidantly suggested your post as answer, just ignore that...

Not applicable

Bar colors

Hi,

In the same place (by clicking "cross" next to the expression -> Background Color) try to write this:

IF(Date>$(=chr(39)&addmonths(max(Date),-12)&chr(39)),lightgreen(),blue()).

Instead of my "Date" field use yours.

Not applicable

Bar colors

This should work fine for you:

IF(makedate(CalendarYear,CalendarMonth)>$(=chr(39)&addmonths(max(makedate(CalendarYear,CalendarMonth)),-12)&chr(39)),lightgreen(),blue())

Instead of "Date" field i wrote "makedate(CalendarYear,CalendarMonth)"

Not applicable

Bar colors

Hello Jusitia,

Unfortunately it doesn't work - everything turns to red. Fortunately expression suggested by Milda works perfectly. Could you elaborate more on bar offset option? Do you have another examples? Thank you very much!

greetings,

Beata

Not applicable

Bar colors

Hi Milda,

It works great! Could you tell me more what chr(39) means? I think I saw it somewhere and I suppose it would be good if I can use it alone;)

Thank you very much,

Grtz,

Beata

Not applicable

Bar colors

I'm sorry for that. I forgot to mention that this is just the basic Idea how it works, Milda did a great Job coding it right for your case! Now you can use this Statement for the bar offset as well. (I try to make this one correct)


IF(makedate(CalendarYear,CalendarMonth)>$(=chr(39)&addmonths(max(makedate(CalendarYear,CalendarMonth)),-12)&chr(39)),1,0)


What I've done is simply replacing the colors with 1 and 0 (1 for Offset and 0 for no Offset).

One Tip from me: Offset doesnt look great and also decreases the charts readability, I suggest using the "Show Value" 2 lines below "Bar offset". The statement is the same as above!

Edit: Please let me know if "Show vale" and/or "bar offset" worked and give Milda the "Verified Answer"

Greets

Not applicable

Bar colors

Hi Beata,

function chr() is used for making some symbols. In this case chr(39) means ' (quates).

All symbols with their codes you can find on www.LookupTables.com.