forums
Use these forums to ask questions and discuss Tableau.
Current Month and Year to Date on same table?
Hi- Just curious if anyone had some thoughts on how to do this... We would like to show the "current month" and the "year to date" on the same table. It appears Tableau does not support this mixed time dimension. The only solution is to paste two tables together based on those different time dimensions. I just wonder if there is another solution using RAWSQL or ? I've got some pretty talented SQL types here.
A very simple example would look something like this:
Metric This month Year to Date
Customers 25 50 <--------- This would be a sum
Average visits 3.1 4.6 <==== this would be an average of both time periods
any thoughts?
Thanks
Joe
Comments
Joe,
I'm not expert in this but Tableau does support the "today" function - would this work if you created two calculated fields - one for the current month (if month(date) = month(today)) and one for year to date?
Something like this appears to work for "Year to date" as a calculated field:
"If
[Date] >= Dateadd('year',-1,today()) then "TRUE"
else "NULL"
end"
Add as a filter to the view
John
I am trying to figure this out, too. I'm thinking about running extra queries but I'd like to be able to simply group new sets of data by different datetimes (M, Y, Quarter).