So you're looking to create Start Date and End Date parameters that will allow you to have a range of dates for both?
I,e,; Start Date: between Date A and Date B
End Date: between Date C and Date D
Something along those lines?
No. Start Date & End Date work exactly as I need. The user can select both to create a date range.
What I need to do now is filter on time within that date range. In the sample workbook you can see that I have selected just 1 day. The time range filter allows me to select anywhere between 0000 hours and 1100 hours for the full day's range.
This range, however, remains the same even if you select a range of multiple days (eg. 01-Nov to 03-Nov). The Time range can only stretch as far as a single 24hr period.
I'm wondering if it's possible to somehow create a time range that is between the two selected dates so that I can, for example view the data between 1900 on the 1st to 0700 on the 2nd.
Thanks for clarifying.
You can create the following time filter that will allow you to select a range between the dates you have selected:
Place the measure pill on the filter shelf and select 'All Values'. Then make the filter a slider.
I think this is what you are looking to achieve.
Hope this helps.
Thanks for the help Don.
This appears to work in the same way as the Time Range filter that I already have set up (unless I've made a mistake somewhere).
When Start and End dates are the same then it works perfectly. But if I change Start and End Dates to 02-Nov and 03-Nov, respectively, then the filter still only shows 24 hours, rather than the expected 48.
This makes it impossible to display 7pm to 7am.
I don't think you'll be able to get what you want using just date dimension. There are only 24 hours in a day and that is how Tableau reports on hours in date format, after 24 hours the day will be incremented by 1.
I believe you will need to settle for a numeric axis or at least a filter if you want to go past 24. Attached are two examples based using datediff in hours, one with the hours on the axis the other with the date.. Let me know if you have any questions.
Sample Hour Range.twbx 52.7 KB
1 of 1 people found this helpful
Have you considered adding a dimension? Use Start Time followed by Sample Period (the number of hours in the sample period)?
A small text box can give the user feedback on the time period selected (e.g. 7PM to 7AM).
Using these values, it should be fairly simple to limit your list to just those values you want.
Please try following approach.
Along with Start date and End date parameter create two new parameters start time and end time.
Now create calculated field based on this as defined in following image.this will filter the time on hourly basis. Create two
start = datepart('hour',[Record Time])>=[Start time]
end datepart('hour',[Record Time])<[End time]
Put these fileds in filters = true.
Now we have values for only hours filtered, attached file for reference. (9.3)
Hour Range.twbx 76.2 KB
Thank you for all the replies.
I've just got back into the office. You've definately given me a lot of options to explore. I'll get back to you in a while.
Ivan and Yogesh. I've tried each of your solutions and I'm afraid they still have't worked out.
Ivan, when I change the Start or End date then, instead of recalculating the hour diffrence, it begins to give me minus figures.
Yogesh, again when I try to take a time period over two days (7pm to 7am) the time filter doesn't work. Perhaps if I can link the Start Time parameter to just Start Date and then End Time to End Date that might work. Currently both are connected to both which creates a conflict.
Michael Hesser, I'll need to put a great deal more thought into this.
I can't imagine that nobody has attempted something similar before.
I've attached an example that gives you the ability to select a range of hours.
i.e.; select between Nov. 2nd @ 7PM and Nov. 3rd @ 7AM
The idea is to change the date format of the 'Record Time' to 'Custom' ( h AM/Pm), which in turn, gives you hours in AM/PM that can be used as your hour filter.
Give it a try and let us know if this works for you.
Time Range Filter.twbx 47.3 KB
Thanks again Don. Unfortunately I only have Tableau up to Version 9.3 (can't open your workbook).
I had a go at doing what you said but couldn't quite get what I needed. Does it work in your Workbook?
I have just spent the day looking into Michael Hesser's suggestion though. I've come up with a solution using just a Start Date and then sample durations.
I created 3 parameters as below -
I then created the following Calc. Field:
[Record Time] >= MAKEDATETIME([Start Date],MAKETIME([Start Time],00,00)) and
[Record Time] <= DATEADD('hour',([Duration]+[Start Time]),[Start Date])
Popped that into filters (set to display 'True'. Showed the parameters and it's all sorted. It took me a while to figure out how to use the Date functions properly, but I've learned a lot. It was smart to approach the problem from a different direction.
I'd still be interested to see if yours works though D Barnetson.