Empty columns and rows can be removed via the suppress option on the crosstab container. If the entire row and or column is empty, missing or zero the supress will remove them from all outputs without the need of JS.
https://www.ibm.com/docs/en/cognos-analytics/11.1.0?topic=cells-use-cognos-analytics-suppression