Well, I see a couple of problems. If you right click on the red pill and choose "Edit Table Calculation", you'll see this:
It looks like, at some point, you had a dimension on your view and set the table calc to restart based on that. But it's gone now and causing an error with the Table calc. If you change that to "None", the error will go away.
You can then go to your filter and choose the dates from July 2017 to January 2018 and you'll get the YTD value of 40 as expected:
Thanks for your response Ken
Unfortunately my filter is going to be used by choosing a single value filter only. The only way i get the YTD figure of 40 is by using a multiple value filter and including every month up to the month i want. What i am looking to do is for it to show the YTD total as of whichever month is chosen. So by choosing January 2018 i want to see a 3 for the month and 40 for YTD.
You're probably going to need to use a parameter instead of a filter then.
How would i do that? Everything i have tried to do using parameters hasn't worked for me. I am still new to Tableau so apologies if this is simple stuff.