Find my approach based on sheet-selection as reference below and stored in attached workbook version 10.3 located in the original thread
1. MTD: datediff("month",[Order Date],#29-10-2016#)=0 and [Order Date]<#29-10-2016# ps. replace #29-10-2016# by today() when your dataset contains current year data
2. Define parameter MTD/YTD
3. Define calculated field Display: MTD/YTD based on parameter defined. Sheets selection in tableau is explained here
4. Drag required objects to the indicated locations on the MTD sheet and set MTD to TRUE
5. Define calculated field YTD: datediff("year",[Order Date],#29-10-2016#)=0 and [Order Date]<#29-10-2016#
6. Drag required objects to the indicated locations on the YTD sheet and set YTD to TRUE
1 of 1 people found this helpful
Hi there are several ways to do this but see below for one
First your data set does not include any sales data for 2017 so I created a field called [ Today() JD ] and set it equal to 12/31/2016 as a substitute
I created a parameter for the switch as shown
Then your Current Month calculation becomes
and your YTD becomes
Your Viz looks like this for YTD
And this for Current
I am on a different version of tableau an you could not open the workbook - sorry
If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.
Here you go.
To adjust calendar to updated. I added order date mod.
Avoid other year's same month
Here is a dynamic calc field.
Glad to help out