Would filtering the data from a datasource filter be a solution? If you do this, it is like the data only contains 10 years instead of 15.
You want the user to see a maximum of 10 years of data, but that 10 year subset can be taken from any of 15 years? For example you have data from 2000-2015. The user can see any maximum combo of 2000 - 2010, 2001 - 2011, 2002 - 2012, ..., 2005 - 2015?
If this is the case you can use 2 parameters for the user to select:
1. either the start year or end year
2. the number of years
Then base calculations from that to display the selected range.
Apologies if I've misunderstood the request here.
Andrew, you understand my request perfectly! I want: "The user can see any
maximum combo of 2000 - 2010, 2001 - 2011, 2002 - 2012, ..., 2005 - 2015?"
I figured the solution would involve parameters, but I'm not very good at
creating them from scratch. Do you have any suggestions as to how I can go
On Thu, Sep 1, 2016 at 12:33 PM, Andrew Watson <email@example.com
Please see the below screenshots if this is what you are trying to achieve using parameter
This can also be achieved using range of dates filter
Attached sample workbook for your reference.
Date display.twbx 350.1 KB
Sure Sedona. There are a few solutions, Praveen supplying one of them above.
Another alternative is to create a parameter for the start year, integer is fine assuming only whole years should be selected, with all of your year values - i.e. 2000, 2001, etc.
Create another parameter with the length of time, again as an integer. This will be a range from X (the minimum time span) to 10, your maximum.
Create a calculated field to use these parameters, something like:
DATETRUNC('year',[YourDateField]) >= MAKEDATE([Parameters].[StartYear],1,1) AND DATETRUNC('year',[YourDateField]) < DATEADD('year',[Parameters].[LengthOfTime],MAKEDATE([Parameters].[StartYear] + 1,1,1))
What that is saying is to only return records where the date is greater than the beginning of the start year and the date is less than your start year +1 plus the time period.
Put the calculated field to the filters shelf and set to true.
Note you'll have to change the field and parameter names to match your actual names and please test it as I haven't, it was typed directly into the forum.
@Praveen P.'s does not show years greater than 10 in the slider. I want user to be able to move maxed out slider along 15 years, but no longer be able to increase the range. I can't tell if your data has years beyond 2002-2012.
Andrew, your calculated field only shows data on Null (not True/False). My Year data is only yyyy so it is an integer, and I feel like the range Length of Time Parameter is on the right track.
Ok, just change the formula, should be even easier: [YearField] >= [Parameters].[StartYear] AND [YearField]) <= [YearField] + [Parameters].[LengthOfTime]
This would show 2002 - 2012 inclusive, for example. Just make it < instead of <= if you prefer it would show 2002 - 2011 inclusive.
Same issue as [YearField] >= [Parameters].[StartYear] AND [YearField]) <= [Parameters].[EndYear]
maybe there could be a way for there to be a parameter for # of years showing and another for start year? The user would be able to choose between 3-10 years and the start year? This wouldn't be a range, however, and I do like the aesthetic of the range slider.
"maybe there could be a way for there to be a parameter for # of years showing and another for start year?" - This is what I suggested
[YearField] >= [Parameters].[StartYear] AND [YearField] <= [YearField] + [Parameters].[LengthOfTime]
There are 2 different parameters referenced, both integers.
I don't know the format of your YearField but you may also need to convert that to an integer - just wrap it in INT() if necessary.
1 of 1 people found this helpful
Right, it's an integer. You should actually drag it up to make it a dimension - drag to the list of dimensions or right click it and convert to dimension.
Now I see it written in Tableau I see I also made a mistake. It should be [BeginTerm]>=[StartYear] AND [BeginTerm]<=[StartYear]+[LengthOfTime]
I would also set up the StartYear as a range of values as well so they can't select things such as year 25.
Fix those 3 things and you should be all good. Hopefully :-)
So close!!!! How does user select start year? It is stuck on default Start Year and Start Year isn't affected by Begin Term Range, so 2002-2009 shows 2002-2004 (less than 3-10 range which is Length of Time Parameter Range) because the earliest year is 1994. The Start Year parameter can't be put into the Filter shelf, so how to add that ?
1 of 1 people found this helpful
Click on the parameter and 'Show parameter control'. A parameter isn't a filter - the calculation we created earlier sits within the filters.
Also remove your Date Term filter as it's not necessary
Ugh, sorry to be difficult. I really like the Number of Years in View Parameter control showing, but the Start Year one just has too many values sothe slider is hard to use. I really want to adjust the Start Year by moving the min thing on the Begin Term multi-value slider around, especially since some dashboards have years 94-09 while others have 00-15 or 01-16 depending on the cohort's entry into the university, so having the Only Relevant Values option in Filters is desirable.