LaSanton
LaSanton

Reputation: 157

Highlight weekends in Tableau in line plot with bands

I have the following question!

I have a line plot showing my completed applications per day.

I want to highlight weekends in a band like the picture below(It's from a plot on excel i think):

Plot that i want

I have already create a metric which is:

IF DATEPART('weekday',[Order Date]) =1 OR DATEPART('weekday',[Order Date]) = 7 
THEN "Weekend" ELSE "Not Weekend" END

But i don't know how to include that so i make a band with it.

Any help would be high appreciated! Thank you!

Upvotes: 0

Views: 1332

Answers (1)

AnilGoyal
AnilGoyal

Reputation: 26218

I have done it like this..

Data - sample superstore

I have added one calc field, where 12000 is max value of my sales value for a given view

IF DATEPART('weekday',[Order Date]) =1 OR DATEPART('weekday',[Order Date]) = 7 
THEN 12000 END

Adding this field to view (dual axix) and tweaking a little, I got

enter image description here

The only problem I see here that there are no bars where no order has been placed on weekends.

This however works perfectly where there are no nulls on dates like in your data. see working on my sample data.

enter image description here

Upvotes: 2

Related Questions