I started looking at this.
You would serve yourself better if you had a date field in there. Doing date manipulations (such at YTD) is so much easier with dates.
Having said that, so far I took your data and created a year field from your [Period] field. (And I moved both [Period] and [year] to dimensions.)
With a year field, you can do YTD by grabbing all the stuff within a given year. However, how do you want to determine the data that determines the "to date" step in computing YTD or QTD? That's going to matter.
Find my approach as reference below and stored in attached workbook version 10.3 located in the original thread
1. D1. Date: MAKEDATE(int(mid([Period],1,4)),int(mid([Period],5,2)),1)
2. M1. YTD: if DATEDIFF('year',[D1. Date],today())=0 and [D1. Date]<today() then [Value] END
3. M2. QTD: if DATEDIFF('quarter',[D1. Date],today())=0 and [D1. Date]<today() then [Value] END
4. M3 M3. YTD/QTD
if [YTD/QTD]='YTD' then [M1. YTD]
elseif [YTD/QTD]='QTD' then [M2. QTD ] END
5. Drag required objects to the indicated locations