Reputation: 3
Original post - https://community.tableau.com/thread/206909
I have a report in which I have sales per month in the column and commodities in the row. The data show actual sales and future estimates for each month.
Need to calculate Year-To-Date (YTD) total for 2016 (from Jan to Previous month) and have it in a single column at the end of the actual values.
I already created a calculated field - YTD
IF
YEAR([DATE]) = YEAR(NOW())
AND
MONTH([DATE])< MONTH(NOW())
THEN
[VALUE/UNIT]
ELSE
0
END
But when I add to the view, it creates a another section for YTD with sum for each month till April.
Can someone please help me in how to achieve this in Tableau?
Upvotes: 0
Views: 2608
Reputation: 3
There are couple of ways to achieve this view in Tableau 1. To create calculated field for each Month and YTD and add measure names in Row & Measure values in Text 2. Make union of 2 queries - one that select all the correct values & second that have YTD calculation in month column. Then use pivot it
Upvotes: 0