I'm trying to insert all the data from my submit table into my fact table. All the fields line up except for the status column. The status table needs to be filled with a status based on the dates. I have the rules that I need for that, but I'm not sure where I should put that logic or even how to do it. Any help is appreciated.
Insert into dbo.FactSubmit
(
ProjectKey,
DueFromSubKey,
SentToKey,
DueFromArcKey,
ReceivedDateKey,
[Description],
Status
)
Select
dp.ProjectKey,
CONVERT(int, Convert(varchar, s.Due_From_Sub ,112)),
CONVERT(int, Convert(varchar,s.Sent_To, 112)),
CONVERT(int, Convert(varchar,s.Due_From_Arc, 112)),
CONVERT(int, Convert(varchar,s.ReceivedDate, 112)),
s.Item_Description
From stg.Submit s
INNER JOIN dbo.DimProject dp
ON s.ProjectID = dp.ProjectID
INNER JOIN stg.Project sp
ON sp.ProjectID = dp.ProjectID