Tableau create a filter with several values in one option - tableau-api

I made a year over year percentage difference of some value in a pivot table. It works ugly: If Year=2018 is selected, the percentage is treaded as 100%. If I choose Year IN (2018, 2017), I can see the proper percentage diff for Year 2018 compared with 2017 treaded as 100%.
One idea I have is to create a radio filter that works like this:
If a user selects Year=2018, I want to show data for Year IN (2018, 2017). So actually two values are selected. The table pivot part with 2017 year is hidden though.
This should work for several Year options.
Is this possible?

What you are looking for are all the years whose difference to the argument is at max one year. So if you choose 2018 as argument, you want to choose 2018 and 2017 from the data, if you choose 1997 you want 1997 and 1996.
So, create a parameter [Date Argument] for your target year. Then create the condition:
DATEDIFF('year',[Date],[Date Argument]) = 0 (OR 1) and add it to the view.
However, I believe what you are trying to do could be more easily achieved using a table calculation.

Related

YoY growth in Tableau

I am trying to get YoY percent growth in Tableau. I would like to see 2015 Jan Unique customers vs 2014 Jan Customers and so on and so forth till the last set of data.
When doing this in Sample super store, I get the following viz.
What I am looking is for a continuous view where the years are not broken down. Something similar to this:
Any suggestions on how I can get to the final stage.
Thanks
If you just use the year in columns, you should get the desired result (Remove the month from column). If it is still creating issues, you can create a calculated column which just has the year and use it in the visualization. The following link should guide you through the steps (Except its a bar chart, so the year would have been converted to discrete. You should be fine with continuous):
https://www.bounteous.com/insights/2015/09/17/how-make-yoy-bar-charts-tableau/
Hope this helps.

PowerBI: How to display/filter row tables between 2 years dynamically

I was wondering if there's a way where I can filter out my table results based on two years. My table A has date column and many miscellaneous columns. So currently I would like the table A to display January 2018 (or 1/1/2018) and December 2019 (or 12/31/2019 --basically ongoing) information. However, once January 1st, 2020 appears, I would like my table A to display row results between January 2019 and December 2020. Is there a way I can do so? Maybe in DAX or clicking some filter option? Could someone show me? I'm still fairly new to PowerBI.
Thanks
The easiest way to meet this requirement is usually using the Relative Date Slicer or Filter functionality:
https://learn.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range
Not sure if any of those options will meet your scenario. Maybe Last 12 Months (Calendar)? Your requirements description didnt make much sense to me - you probably need to explain "ongoing" and "appears".
If the Relative Date functions dont meet your needs, then you'll need to construct a column (in Power Query or DAX) that returns a static value you can use in a Slicer or Filter.

Change filter order of values based on parameter

​Hi all,
I am trying to change the order of the values in the filter based on a parameter I've chosen. For example if I choose "Calendar" in the parameter, I'd want my filter values to start from January, February, March... until December. If I choose "Financial" in my parameter, I'd want it to start from July, August, September... Til June as the last month.
How can I implement this?
Thanks
I would create additional calculated fields that represent the numerical order of my months. For example, "calendar" would give January a value of 1, Feb 2, and so on. In a similar manner, "financial" would give July 1, Sept 2, etc.
From there, you can make a parameter control that dictates the sort that you should use. This is a great tutorial on doing that.
Create Parameter control for sort in Tableau
The generated sort fields that are created to dictate the sort order should not have to be shown on your final viz.

Summarize years 2010-2013 display detail of 2014 and 2015

I'm new to crystal reports 2011 and I'm trying to develop a report that shows the monthly detail for years 2014 and 2015, and only summarizes years 2010-2013. I have the year as my grouping and I"m able to see all 6 years data summarized when I hide the drill down, but I want to show my customer the monthly data from 2014 and 2015 in detail. Any help would be appreciated!
There's a few ways this can be done:
Group on both year & month. In the "section expert" dialogue, define a formula to conditionally suppress the monthly details for appropriate years, e.g., {table.year} < "2014" (assuming year is a string, change as needed.
Define your own formula and then group on that custom formula, e.g.,:
if {table.year} < "2014" then {table.year} else
{table.month} & " " & {table.year}
The second one also presumes your values are stored as strings, you can use totext() to convert non-strong values if necessary. Option 1 is probably easier to present nicely, Option 2 might give a greater level of flexibility for future use of the rpt as a template with arbitrary grouping, though might still require multiple groups and conditional suppression to have it display exactly as desired, but these should point you in the right direction.
You can create 2 groups, one by year and one by month and write supress condition of month group like when year < 2014 then supress.
if year<2014
then true
else false

Conditional formatting by month based on year

Working with Google Sheets, I'm currently making a year schedule. The sheet should be recycled every year.
Column A has several dates.
D2 is the year, e.g. 2015, 2016 or 2017.
I'm trying to apply conditional formatting to column A. Every month to get its own colour. January coldblue, February blue, March little bit green, et cetera.
The easy way is to use date before .., like 'date before 1-2-2015' for January. But then, the conditional formatting should be altered every year.
How can I use custom formulae (in conditional formatting) using the year from D2 + before start of the next month?
I would not recommend that many different colours (if only because each colour after the first needs a separate rule!) and don't really see the point of D2 for the CF - unless you plan to have a separate set of 12 colours for each year? However, I think what you request is a plethora of formulae like:
=and(year(A1)=D$2,month(A1)=1)
to be repeated with the last 1 changed in integer steps all the way to 12, with a different colour for each such value.