The error clearly states table Bagtall is not found, so I would double check if you are 100% sure that is the name of the table (case sensitive) and if that table was loaded before you reference it in this part of the script.
For quarter I would not bother with creating the mapping table but instead use this:
'Q' & CEIL(Month(TempDate)/3) AS Quarter,
Also note that your WeekYear is going wrong in week 52, 53 and 1, so I would use this script instead:
Week(TempDate) &'-' &
If(Week(TempDate)=1 AND Month(TempDate)=12,Year(TempDate)+1,
If(Match( Week(TempDate), 52, 53) AND Month(TempDate)=1, Year(TempDate)-1,
I have loaded the tables via the Data Manager and created the Master Calendar script in the Data Load editor.
In the Data editor there is only the calendar, Main and the Auto Generated section, which are the tables from the Data Manager. If I display the Auto Generated section, to me it looks like the table is loaded. If I try to unlock the Auto Generated section I am told that I will not be able to edit the data selection with Data manager.
Since I'm not to familiar with scripting (as you probably guessed already ) I am a little unsure if I should unlock the section.
I also see the tables in the Data manager, as well as all data - except the calendar - is showing in my app.