3 Replies Latest reply on Oct 21, 2015 8:05 AM by Kent Sloan

# Plotting graph based on this this week's date as well as same days last week

Hey guys,

Big fan of this forum. Need your expertise on the problem i am facing. Below is the original data in my EXCEL which i am uploading to tableau and saving as extract.. I will leep adding data at the end of the row everyday and refresh and the extract.

 Area Date Percentage Bandwidth status 7-Oct-15 21% Bandwidth status 8-Oct-15 69% Bandwidth status 9-Oct-15 67% Bandwidth status 10-Oct-15 15% Bandwidth status 11-Oct-15 66% Bandwidth status 12-Oct-15 23% Bandwidth status 13-Oct-15 67% Bandwidth status 14-Oct-15 15% Bandwidth status 15-Oct-15 66% Bandwidth status 16-Oct-15 67% Bandwidth status 17-Oct-15 15% Bandwidth status 18-Oct-15 66% Bandwidth status 19-Oct-15 67% Bandwidth status 20-Oct-15 15%

So here's the solutioni need:

1. First thing. I need the bar graph for today()-3 days. I.e. if today was 20th oct, i need the graph to be plotted for 20th, 19th and 18th. When i refresh teh data on 21st, it should automatically update. Probbably we can use datediff for this.
2. Second thing: Along with those 3 days, i need to plot data for last week, same day. i.e. If today is 20th, i need data to plot graph for 20th,19th,18th and 13th,12th and 11th. I am not sure how to use LOOKUP formula for this.

I have attached the sample answer i am looking for. Please note that, as the day moves forward, whenever i refresh, data should automatically refresh. Ex: If today is 21st, when i refresh, data should automatically change to 21,20,19,14,13,12.

Tried with many things but couldnt figure out this one simple thing.

Also it would be of great help if you can let me know some websites where i can learn tableau well.

• ###### 1. Re: Plotting graph based on this this week's date as well as same days last week

Hello Babu,

Below is the formula I used to create the groups you described. I also included a parameter driven version where the user can select the number of days to go back and how many days to compare. To pick up some more of the basics of Tableau I would recommend checking out the InterWorks Tableau Essentials blog series. For general reading I would lookup the list of Tableau Zen Masters and look over their blogs. I hope this helps!

END

Thanks,

Kent Sloan

InterWorks

• ###### 2. Re: Plotting graph based on this this week's date as well as same days last week

Hi Kent,

The solution looks great. Thank you so much.

However is there anyway we can get the solution like below:

First get the recent 3 dates(today, yest and day before yest) using datediff or dateadd, then use LOOKUP to get last week's date and data??

• ###### 3. Re: Plotting graph based on this this week's date as well as same days last week

Hi Babu,

I personally would avoid using a table calculation for this unless there was a situation that required it. Attached is an updated version of the example that uses a table calc to lookup the percentage for the previous week.

Thanks,

Kent