Попробуйте
Select * from (
SELECT
dbo.FormatAmountforCustomQuery(FORMAT(SUM(pcptlc.Value),'N')) AS [Planned]
,dbo.FormatAmountforCustomQuery(FORMAT((REPLACE(REPLACE([Committed],',',''),'$','') - SUM(pcptlc.Value)),'N')) AS [To Be Planned]
,dbo.FormatAmountforCustomQuery(FORMAT(SUM(pcptla.Value),'N')) AS [Actual]
,dbo.FormatAmountforCustomQuery(FORMAT((REPLACE(REPLACE([Committed],',',''),'$','') - SUM(pcptla.Value)),'N')) AS [Remaining]
from XPV.MyFIlterView d1
) as FilteredView
ORDER BY 1,4 DESC
Вы также можете использовать с clouse
WITH FilteredView AS (
SELECT
dbo.FormatAmountforCustomQuery(FORMAT(SUM(pcptlc.Value),'N')) AS [Planned]
,dbo.FormatAmountforCustomQuery(FORMAT((REPLACE(REPLACE([Committed],',',''),'$','') - SUM(pcptlc.Value)),'N')) AS [To Be Planned]
,dbo.FormatAmountforCustomQuery(FORMAT(SUM(pcptla.Value),'N')) AS [Actual]
,dbo.FormatAmountforCustomQuery(FORMAT((REPLACE(REPLACE([Committed],',',''),'$','') - SUM(pcptla.Value)),'N')) AS [Remaining]
from XPV.MyFIlterView d1
)
SELECT * FROM FilteredView
ORDER BY 1,4 DESC