/* Supplier Diversity Spend — detail (DatawarehouseNCM) Fact: dbo.FactSupplierDiversitySpend BackOffice: frmRptSupplierDiversityRpt / Crystal: SupplierDiversitySpend.rpt Qualifying diversity spend lines. Report date filter is TransactionDate. Fact is already filtered to PaidTo=2 / PaidBy=1 / not denied / not track-only / submitted for payment. */ DECLARE @StartDate datetime = '2026-01-01'; DECLARE @EndDate datetime = '2026-01-31'; DECLARE @CorpCode varchar(15) = NULL; -- NULL / '' = All clients SELECT f.CorpCode, c.FormalName, f.ParentCompany, f.TEFileNo, f.TELastName, f.TEFirstName, f.TransactionDate, f.VendorParentID, f.CompanyName, f.VendorId, f.Payee, f.Category, f.Amount, f.DiversityCertification, f.SubClassDescr, f.VendorType, f.DiversityComments FROM dbo.FactSupplierDiversitySpend f LEFT JOIN dbo.DimCorpClient c ON RTRIM(c.CorpCode) = RTRIM(f.CorpCode) WHERE f.TransactionDate BETWEEN @StartDate AND @EndDate AND (@CorpCode IS NULL OR @CorpCode = '' OR f.CorpCode = @CorpCode) ORDER BY f.CompanyName, f.CorpCode, f.TransactionDate DESC, f.TEFileNo;