7 Replies Latest reply on Jul 12, 2016 11:47 AM by Chris Dickson

# YTD Graph

Hi,

Can somebody please provide me with guidance on creating a YTD graph that doesn't show the YTD totals for all previous months? I just want one bar to show the YTD value of A and another for B.

This is what I have so far:

• ###### 1. Re: YTD Graph

See if this works...I created a dummy data set for A and B by month/year.

Then, I created a parameter to select the month/year you want to display YTD values for.

Then, I created calculated fields for both A and B, using the following formula:

{include [Date] :

sum(IF year([Date])=year([Select Month])

and month([Date])<= datepart('month',[Select Month])

THEN [A]

ELSE 0

END)}

Here is an example output when Jun 2016 is selected:

I am also attaching the workbook.

• ###### 2. Re: YTD Graph

Thank you for helping me out.

Unfortunately, this didn't work for me, and I'm unable to open the workbook to see exactly what you did because it's created with a newer version of Tableau.

• ###### 3. Re: YTD Graph

Ok, if you are able to create the calculated fields - one for A and another for B - using the calculation formula I used, you should be able to create the chart or table to show YTD numbers for the selected month.

Here is a Screen shot for A. You can duplicate it for B.

Here is a screen shot of how my worksheet looks

I am attaching my Excel worksheet if you want to try it out...

Let me know if you need additional help.

• ###### 4. Re: YTD Graph

Can you please include a screen shot of the parameter you created?

• ###### 5. Re: YTD Graph

Sure, see below. I just created it using the List option and by directly importing all values from the Date column.

• ###### 6. Re: YTD Graph

Hi Erin what version of Tableau are you using?

There is a slightly older fashioned way to achieve what you want without LOD, but is easier to show you.

• ###### 7. Re: YTD Graph

Also i'm assuming Month is a fixed dimension and not calculated from a date field where you could simply change it to year rather than month?

I created the attached in 8.3, it requires the creation of a table calc

[HideFalse] = Last()=0

Drag this onto the columns shelf in between month and product, set the table calculation to calculate over month, then right click on any of the ones that say False and 'Hide'