I have a fairly simple pivot I created for getting the sum of years put into columns. But I'd like to add the count of DistinctConsumers into the same pivot so they are displayed across the columns as wee. Is there a solution for this?
My query looks like this:
SELECT *
INTO #summaryone
FROM (
SELECT
FY
,Provider
,DistinctConsumers
,Service
,PaidAmt
FROM #Summary) AS ProviderAmts
PIVOT
(SUM(PaidAmt)
FOR FY
IN (
FY21
,FY22
,FY23
,FY24
,FY25
)
) AS PivotTable
I want my output to look like this: