Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Distinguish weekdays and weekends in bar chart

I've got a stacked bar chart showing sales by region by day for a month. I'd like to be able to show which days are weekends and which are not--I expect the numbers to be lower on weekends, so being able to see dips that are not on a weekend would be helpful.

I tried conditional formatting using the WeekEnd() function but it's not working and I'm not sure if it's the best approach. Any ideas?

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

The weekend() function returns a timestamp for the last millisecond of the last day of the week.  It is not a true/false flag for whether something is a weekend or not.  You could use the weekday() function, perhaps to color the bar differently, so a background color expression like this:

if(match(weekday(Date),'Sat','Sun'),lightgray(),blue())

View solution in original post

4 Replies
johnw
Champion III
Champion III

The weekend() function returns a timestamp for the last millisecond of the last day of the week.  It is not a true/false flag for whether something is a weekend or not.  You could use the weekday() function, perhaps to color the bar differently, so a background color expression like this:

if(match(weekday(Date),'Sat','Sun'),lightgray(),blue())

Not applicable
Author

Thanks John - that's helpful and it works.

It does change the color of the entire bar for each day, though, so I couldn't see my stacked colors in each bar. So instead I used the same expression in the text color property to change the color of the totals displayed at the top of each bar. 

Not sure if it's possible, but it would be cool to be able to apply a transparency level to the existing colors, rather than a new single background color.

johnw
Champion III
Champion III

How about the attached?  I had to create a table of colors (R,G,B) for customers instead of using the defaults.  If customers are missing from the table, they're assigned a color randomly.  I went ahead and made a weekend flag to save time in the chart.  Then I assign a transparency value to weekends like you suggested:

if(Weekend,argb(100,R,G,B),rgb(R,G,B))

Not applicable
Author

Sweet