-
1. Re: Time periods in Tableau
Ken Patton May 13, 2015 5:33 PM (in response to Mark Fraser)Thank you for putting this together!
If we can figure out "Prior Quarter" and "Prior Year" this will be epic! (ignoring Fiscal calendars, of course. )
Well done, sir.
-
2. Re: Time periods in Tableau
Joey Minix May 19, 2015 6:43 AM (in response to Ken Patton)1 of 1 people found this helpfulI create indexes for dateparts to handle prior quarter, prior year, etc..
DATEDIFF('quarter', [Date], {fixed:max([Date]) } )
Then, if I want to do it as Mark has, I can just say
IF [QuarterIndex] = 1 THEN [MyMeasure] ELSE 0 END
Naturally, if your [Date] field doesn't include the current period, you'd want [QuarterIndex] = 0 for prior quarter
If still in 8.3, for most applications you can replace {fixed:max([Date])}) with today(), but I prefer not to do that when I can avoid it.
QuarterIndex = 0 # This Quarter
QuarterIndex = 1 # Last Quarter
...
QuarterIndex = 5 # Last Year-LastQuarter
...
etc
In many of my reports, I actually like to add a [ReportDate] to my dataset, and append data at the source rather than replace it. I put a calendar in the report so users can select dates on the calendar to see how the data looked on that day (or month or week, etc).
To keep dataset sizes manageable I keep only data where ReportDate > some value, 15 days ago, 30 days ago, 60 days ago, etc.
In these cases, Date Indexes are really useful.
-
3. Re: Time periods in Tableau
danielle.weaver May 24, 2015 6:35 PM (in response to Mark Fraser)Well done! I find myself needing these standard date calculations in most of the dashboards I develop too.
-
4. Re: Time periods in Tableau
Jaideep Rokade May 27, 2015 3:36 AM (in response to Mark Fraser)I was looking for this...
Thanks
-
5. Re: Time periods in Tableau
ashish.sathish Oct 6, 2015 2:41 PM (in response to Mark Fraser)What if I am comparing week to week aggregation on the same date field?
I am fairly new to Tableau, Please bear with my naivety.
-
6. Re: Time periods in Tableau
Mark FraserOct 7, 2015 4:16 AM (in response to ashish.sathish)
Hi Ashish
Welcome to the forums!
You can use Tableau for week on week comparison, how easy it is will depend on your data...
Here is a basic example using the Superstore data
I use the inbuilt Difference function (shown below) to show week on week sales performance.
That is super easy - 2 minute job.
But as mentioned it depends on your data... if you have a sample you can provide with expected results I'll try take a look.
PS. If you post the question on the main forum it will have more visibility, otherwise it will just be me
Cheers
Mark
-
7. Re: Time periods in Tableau
Wes Reneau Oct 29, 2015 3:48 PM (in response to Mark Fraser)2 of 2 people found this helpfulHey Mark, Fantastic post!
One question, how would you change the WTD calculation to start on the 1st of the month so you don't run into WTD > MTD situations when a month doesn't start on a Monday?
For example, this month (October 2015) started on a Thursday, meaning the WTD values would be larger than the MTD values since WTD would include September 28-30 while MTD would only include October 1-2.
Thoughts?
-Wes