You're trying to PIVOT
on dates. If the date range is something like a full year, then you would exceed the 255 maximum columns for a table or query.
If you want to PIVOT
on dates, you must select a narrower date range. See whether the query can work with data from a single month.