SELECT ChannelSubClassAltDesc,
SUM(CASE WHEN fact.currencytypehierarchyid = 5 THEN BudgetAmount END)*(-1) as BudgetAdjAmtCD
,SUM(CASE WHEN fact.currencytypehierarchyid = 3 THEN BudgetAmount END) * (-1) as BudgetAdjAmtUSD
–,SUM(CASE WHEN fact.currencytypehierarchyid = 4 THEN BudgetAmount END) * (-1) as BudgetAdjAmtLC
FROM [MARS].dbo.vwFactIncomeStatementBudgetALTRestricted Fact (NOLOCK)
JOIN [MARS].[dbo].[FinancialAccountAlt] FA
ON Fact.[FinancialAccountAltId]= FA.[FinancialAccountAltId]
JOIN [Mars].[dbo].[ChannelSubClassAlt] CC ON CC.ChannelSubClassAltID = FA.ChannelSubClassAltID
JOIN [MARS].dbo.productfamilyAlt PFAM (NOLOCK)
ON PFAM.productfamilyAltid =fact.productfamilyAltid
JOIN [MARS].[dbo].[FiscalMonth] FiscalMo83
ON Fact.[FiscalMonthID]=FiscalMo83.[FiscalMonthID]
JOIN [MARS].[dbo].[ProfitCenterAlt] ProfitC120
ON Fact.[ProfitCenterAltID]=ProfitC120.[ProfitCenterAltID]
JOIN [MARS].[dbo].[SAPCompany] SAPComp142
ON Fact.[SAPCompanyID]=SAPComp142.[SAPCompanyID]
JOIN [MARS].[dbo].[vwMsrBundleStatus] vwMsrBu209
ON Fact.[BundleStatusID]=vwMsrBu209.[BundleStatusID]