-
1. Re: Select year and previous year based on same filter
Shinichiro MurakamiFeb 10, 2019 9:44 PM (in response to Amit Darak)
Hi Amit,
Normal filter filters underlying data and you cannot show previous year once you filter a certain year.
There is workaround but very different from the version.
Unless you don't have 2018.3, it's quite a bit troublesome. What is your version?
Shin
-
2. Re: Select year and previous year based on same filter
Amit Darak Feb 10, 2019 9:54 PM (in response to Shinichiro Murakami)Hi Shin,
I have Tableau 2018.2.
-
3. Re: Select year and previous year based on same filter
tian.yang.4 Feb 10, 2019 10:15 PM (in response to Amit Darak)Hi Amit,
Please see attached workbook.
If anything unclear please let me know.
If this posts assists in resolving the question, please mark it helpful or as the ' correct answer' if it resolves the question.
YT
-
4. Re: Select year and previous year based on same filter
Shinichiro MurakamiFeb 10, 2019 10:18 PM (in response to Amit Darak)
If the version is 2018.2, Tian's answer with using Parameter instead of filter should be the best way.
Shin
-
5. Re: Select year and previous year based on same filter
tian.yang.4 Feb 10, 2019 10:20 PM (in response to Amit Darak) -
6. Re: Select year and previous year based on same filter
megha gawali Feb 11, 2019 1:16 AM (in response to Amit Darak)Hello Amit,
You can try out this.
Current Year filter
[Year]=DATEPART('year', [Order Date])
Previous year filter
YEAR([Order Date])=[Year]-1
-
7. Re: Select year and previous year based on same filter
michael.lowden Feb 11, 2019 7:45 AM (in response to Amit Darak)I agree with the previous posts regarding a Parameter instead of a basic filter.
For people that don't want to download the TWBs:
1. Create your [Year] parameter : I'd suggest an Integer Range (formatted without decimals or commas), 2000-2040 or something so you don't have to bother with it for a long time. Or just allow people to enter whatever they'd like manually using "Allowable Values: ALL"
2. Create a calculated field ("Previous Year") : [Parameters].[Year]-1
--- Make this field a Dimension (just drag it from Measures to Dimensions)
3. Create filters as needed against the appropriate value. Either [Parameters].[Year], or the [Previous Year] field created above
-
8. Re: Select year and previous year based on same filter
michael.lowden Feb 11, 2019 7:47 AM (in response to michael.lowden)another bonus of Parameters is that they are carried across all sheets / pages / etc. within your dashboard. So it's an 'enter once and forget it' kind of scenario where Filters can be per-sheet and get easily lost in the weeds of a dashboard, or duplicated for no reason. You could also have two Parameters "Select Primary Year" and "Selected Comparison Year" so users could choose 2019-vs-2015 if they wanted.