forums
Use these forums to ask questions and discuss Tableau.
Specific Week Dates Shown
Posted May 5th, 2008 by Joe
Any hints on showing the actual date range for the week reported instead of the default [Week 15]. Feedback we have received from some indicates that the week number is not very helpful.
So how do you convert /Week 15/ to equal something like /April 17 - April 23/
Thanks
Joe
Comments
So the problem with what you propose is that the week numbers don't always align with the same date ranges each year. So if you are looking at data that spans several years, one year week 15 may be April 17-April 23 but the next year week 15 is April 19-April 25. Which label do you use?
Nope, I just want the 'Label' to appear and not the week number. The client does not like 'week 15' they like 'April x - April x' How can I get the label to appear instead of the generic week number?
Thanks
Joe
Easiest way to do this is create a [Week of] field:
DATETRUNC('week',[Date])Although it does not indicate a range, it will sort automatically and aggregate by Month, Quarter, or Year, which is useful.
Alternatively you can create a [Week ending] field, which exploits the fact that the Date/Time value for one day is 1:
DATETRUNC('week',[Date])+6If you must have a range, you can create a messy calculated field that combines the two into a date range string. In order to sort chronologically, you will need to set this field to sort by either the "Week of" or "Week ending" field:
DATENAME('month',[Week of])+" "+STR(datepart('day',[Week of]))+"-"+
// Check to see if week starts and ends in the same month
// If it does then omit the month of the week ending date
IF DATEPART('month',[Week ending])=DATEPART('month',[Week of])
THEN ""
ELSE DATENAME('month',[Week ending])+" "
END
+STR(DATEPART('day',[Week ending]))
Worked like a charm. Thanks.
Joe