Thanks a lot for your help. But it doesn't solve the Problem that I have. I want to have either a year Analysis or a month Analysis and not both. but a month Analysis concludes also the inherrent year. Do you understand what I mean?
You can achieve this in a single sheet. Here are the steps -
1) First create a parameter. In which I am using two values 1 (Year) & 2 (Month)
2) Create a calculated field -
if [Select Period Parameter]==1 then str(year([Order Date])) else str(month([Order Date]))+''+str(year([Order Date])) end
Use this field into column section. Before this put Year(Date) field so proper formatting.
3) Create another calculated field for your measure -
if [Select Period]==1 then (ZN(SUM([Sales])) - LOOKUP(ZN(SUM([Sales])), -1))
else (ZN(SUM([Sales])) - LOOKUP(ZN(SUM([Sales])), -12)) end
Use this field instead of Sales.
Check the attached file.
Hope this may help!
Period Difference_PS.twbx 968.7 KB
Hi Kumar and hi Sharma
My problem isn't how to make an analysis to choose between year or month analysis. What I want is:
When user choose month analysis (it has to contain the year):
January, February from the years 2012, 2013
tableau should show the turnovers from these months and make a difference of the turnover from January 2012 vs. January 2013, February 2012 vs. February 2013 (this use case I can solve, it is not my problem)
When user choose year analysis (it contains no month)
2013, 2014, 2015
tableau should show the difference of the turnover between the year. This is my Problem
Do you know what I mean? Please take a look at the attachement from the original post. The first use case is done, the second not.
Thanks a lot for your help and best regards
Have you checked the workbook attached by me?? In that when you choose year, it will show you difference by year i.e. 2014-2013, 2013-2012 & when you choose month then it will show you difference by month like jan 2015 - jan 2014, feb 2015 - feb 2014.
Is it something like the attached you want?
This is the formula used for Month:
IF [Parameters].[Interval] = "Month" THEN MONTH([Date]) END
Here is a screenshot for Interval = Year:
Buch2 kettan thread 155627.twbx 23.8 KB
@ Sharma: It's really embarrassing that I overlooked your workbook Sharma. I'm very sorry for this. I'd just checked the other 2 workbooks. Your solution isn't exactly what I want because I can't choose the months I want to compare. If I drag the order date (months) into filter box tableau can't interpret them because they have values such like 201001 201002. I want to offer the user a list of months they can choose (January, Feburary, etc.)
@ Kettan: the problem of your solution is the following that the user has to select the months when he switches to interval "year" otherwise tableau only sum the turnovers of the selected months. This means for the attached picture from you: the turnovers of the year 2011 and 2012 are not complete because the month april isn't chosen. I want to offer the user the convenience that when they choose interval year tableau automatically show the turnover of the whole year (the user doesn't have to select all months).
Thanks a lot and best regards
The filter for month was in your original workbook. I didn't remove it because I thought you wanted it.
The attached is the same except month filter is removed and thus all months included.
The Parameter is also needed.
The user should be able to choose:
1. the interval
2. the year
3. the months (if they've Chosen month interval)
When you remove the Parameter so when the user choose interval months all months are shown but it isn't that what I want. when the user chooses month interval so they have to choose the desired months (they not really want to see the comparison of all months of selected years)
thanks a lot and best regards
Hi Dyna softAG
Does this help you? Based on kettan's workbook v2, I have two separate sheets which are on the dashboard - the 'Yr' sheet shows when the user selects the 'Year' interval, and 'Mth' shows when the user selects the 'Month' interval.
The 'Yr' sheet does not filter out any of the months so you are always showing all months but you have the ability to select months if the 'Month' interval is chosen. The 'Spacer' sheet is used to hide the Month filter when it is not needed (and kettan has already given you the links to instructions for this).
Thanks a lot for your help. I have to study how you did it but it's a very useful solution. thanks a lot.