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: 
lessassy
Creator
Creator

Color on a bar chart based on value (value = date from master calendar)

Hello Everyone,

I'm using the master calendar in my script.

And I used that to display specific value based on weekyear (weeknumber and year)

Recent.PNG

What i want to do is to put in Green the most recent bar in the chart. The most recent one is 20.2018 and i want it to be in different color for comparison aspect.

I know i have to go to background in the expression view

color.PNG

But as i'm a newcomer for qlikview i don't know the right formula to put in order to have the bar chart in blue for the latest (most recent week).

As I previously said I have a master calendar in my script

MasterCalendar: 

Load 

               TempDate as Created, 

               week(TempDate) As Week, 

               Year(TempDate) As Year, 

               Month(TempDate) As Month, 

               Day(TempDate) As Day, 

               YeartoDate(TempDate)*-1 as CurYTDFlag, 

               YeartoDate(TempDate,-1)*-1 as LastYTDFlag, 

               inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12, 

               date(monthstart(TempDate), 'MMM-YYYY') as MonthYear, 

               ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter, 

               Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear, 

               WeekDay(TempDate) as WeekDay 

And the field of the bar chart  (which represent the expression i used in the form (sum(LossBU))  is

field f.PNG

Anyone can help ?

Thank You

1 Solution

Accepted Solutions
Janneke
Creator
Creator

if the variable in the script is not working, delete it.

You need to get the expression right. Use a text box to make sure you have everything correct in the set analysis part. Try adding an = after dollar: $(=vMax....

View solution in original post

23 Replies
m_woolf
Master II
Master II

if(WeekYear = max(WeekYear),lightgreen())

lessassy
Creator
Creator
Author

It doesn't work unfortunately.

DOes it have to do with the fact that almost every bar chart of mine have a empty space like in the image belowEmpty value.PNG

ANd on the other hand, it (kind of) work for another chart. Except that it doesn' take into  account the last month

MTTR greeen.PNG

Does this struggle have to do with the master calendar ?

Thank you in advance

Anonymous
Not applicable

Can you post a sample version of the app?

shansundar
Partner - Creator
Partner - Creator

Try using Maxstring like below,

if(only({1}WeekYear) = maxstring(WeekYear),lightgreen())


I just included {1} to ignore all report selections.


Thanks,

Shan S

Anil_Babu_Samineni

Once you done that which provide by mwoolf you need to do "Suppress When Value is Null" for that dimension

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
lessassy
Creator
Creator
Author

THank you for trying but unfortunately it's not working

Greenweekyear.PNG

Everything turn green whereas it's not really what i want.

Here is my master calendar, just in case it can help:

"

QuartersMap: 

MAPPING LOAD  

rowno() as Month, 

'Q' & Ceil (rowno()/3) as Quarter 

AUTOGENERATE (12); 

 

Temp: 

Load 

               min(Created) as minDate, 

               max(Created) as maxDate 

Resident MyTable1; 

 

Let varMinDate = Num(Peek('minDate', 0, 'Temp')); 

Let varMaxDate = Num(Peek('maxDate', 0, 'Temp')); 

DROP Table Temp; 

 

TempCalendar: 

LOAD 

               $(varMinDate) + Iterno()-1 As Num, 

               Date($(varMinDate) + IterNo() - 1) as TempDate 

               AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate); 

 

MasterCalendar: 

Load 

               TempDate as Created, 

               week(TempDate) As Week, 

               Year(TempDate) As Year, 

               Month(TempDate) As Month, 

               Day(TempDate) As Day, 

               YeartoDate(TempDate)*-1 as CurYTDFlag, 

               YeartoDate(TempDate,-1)*-1 as LastYTDFlag, 

               inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12, 

               date(monthstart(TempDate), 'MMM-YYYY') as MonthYear, 

               ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter, 

               Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear, 

               WeekDay(TempDate) as WeekDay 

Resident TempCalendar 

Order By TempDate ASC; 

Drop Table TempCalendar;  "

Thank you for your help

lessassy
Creator
Creator
Author

I cannot do suppres when value is null because i also want to display the month where there are no datas.

But THis is not that important.

What i can't figure out is why the formula doesn't work.

Does it have to do with the master calendar ?

Anil_Babu_Samineni

Can you attach application?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
lessassy
Creator
Creator
Author

Here are the files i use.

I have qlikview personnal edition by the way. SO I won't be able to use the file once modify...