1 2 Previous Next 20 Replies Latest reply on Feb 26, 2015 4:12 AM by juliette.mccormack

# Dynamical show by month or by year

Hello everyone

How can I make an Analysis with the following properties:

The user can choose if they want to have year or month Analysis. they can choose also the years and the months they want to compare. the difference should be done like this (when the user chooses "month") 01.2011 vs 01.2012, 01.2012 vs. 01.2013, 02.2011 vs 02.2012, 02.2012 vs. 02.2013, 01.2011 vs 02.2012, 02.2012 vs. 02.2013. when "year" is Chosen so 2011 vs. 2012, 2012 vs. 2013. Do you have any idea how I can make it?

Thanks a lot for your help and best regards

• ###### 1. Re: Dynamical show by month or by year

Hi,

Go through below post, where i clearly explained how to Select Year, Months Dynamically (By using Parameters.)

Sales display over continuous months

Best Regards

Laxman Kumar

• ###### 2. Re: Dynamical show by month or by year

hi Kumar

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?

Best regards

• ###### 3. Re: Dynamical show by month or by year

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!

Warm Regards,

Prashant Sharma - India | LinkedIn

• ###### 4. Re: Dynamical show by month or by year

It may not exact solution but it can help you, by using 2 Quick Filters............

• ###### 5. Re: Dynamical show by month or by year

It may not exact solution but it can help you, Using 2 Quick Filters, 1 is for Year, another is for Month............

• ###### 6. Re: Dynamical show by month or by year

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

• ###### 7. Re: Dynamical show by month or by year

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.

Warm Regards,

Prashant Sharma - India | LinkedIn

• ###### 8. Re: Dynamical show by month or by year

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:

• ###### 9. Re: Dynamical show by month or by year

Hi everybody

@ 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

• ###### 10. Re: Dynamical show by month or by year

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.

• ###### 11. Re: Dynamical show by month or by year

Hi Kettan

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

• ###### 12. Re: Dynamical show by month or by year

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).

BW

Juliette

• ###### 13. Re: Dynamical show by month or by year

Hi Juliette

Thanks a lot for your help. I have to study how you did it but it's a very useful solution. thanks a lot.

Best regards

• ###### 14. Re: Dynamical show by month or by year

You're welcome - but kettan had done all the hard work.  I just finished it off.

If you get stuck working through it, let us know.

Best wishes

Juliette

1 2 Previous Next