Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tinkerz1
Creator II
Creator II

Background colours for dates not working

Hi,

I use the below code to make the date dimension in a pivot table, but the following code for coloring the backgorund for dates only works on the first 2 dates, what could be happening not to color the full selection?

=if(Num([Download Month-Year])>=num(MONTHSTART(Min_Date))  and Num([Download Month-Year])<=num(MONTHEND(Max_Date)),[MonthYear])

 

=if(Num([Download Month-Year])>=num(MONTHSTART(Min_Date)) and Num([Download Month-Year])<=num(MONTHEND(Max_Date)),Yellow())

12 Replies
tyagishaila
Specialist
Specialist

could you please share screen shot to know that exactly what happening.

roger_stone
Creator III
Creator III

You have only supplied a colour (yellow) when the IF statement is true, but no colour for false.

tinkerz1
Creator II
Creator II
Author

For information this is the new background code:

 

=if(Num([Download Month-Year])>=num(MONTHSTART(Min_Date)) and Num([Download Month-Year])<=num(MONTHEND(Max_Date)),Yellow(),red())

But the dates stayed white.

Anonymous
Not applicable

what is the max value of your date field??

roger_stone
Creator III
Creator III

Looking at that screenshot, I think this may have more to do with nulls in your data.

Anonymous
Not applicable

From your background code, and attached image:

=if(Num([Download Month-Year])>=num(MONTHSTART(Min_Date)) and Num([Download Month-Year])<=num(MONTHEND(Max_Date)),Yellow(),red())


It seems the max value of Date Field is Oct 2015 only, is it??

tinkerz1
Creator II
Creator II
Author

 

=MONTHEND(Max_Date) is 29/02/2016

tyagishaila
Specialist
Specialist

you can try it;

right click on dimension --->go to Custom format cell ,

from here you can provide background colour as per your requirement.

tinkerz1
Creator II
Creator II
Author

Thanks but then I will have to do that every time I run a report for a new month