I have this
SELECT * FROM ( SELECT [cmpcode], [el2], [period], [curdoc], [valuedoc] FROM [icarus].[dbo].[fxm_dochead_allyears_full] WHERE [yr] = '2021' AND cmpcode = 'Z992' ) x PIVOT ( SUM ([valuedoc]) FOR [period] IN (, , , , , , , , , , , ) ) AS pivot_table;
This works but generates lots of NULL values where there are no values for a particular month.
Where do I wrap my ISNULL? Everywhere I've tried doesn't work and if I try
ISNULL (, 0) AS 
inside of the PIVOT piece of code it errors without running.
Any help appreciated and thank you for reading.