delete
@wonka1234 a good trick to deal with dynamic columns is to transpose the data, do what you need to do (after transposing you will have always a fixed known schema) and then use the cross tab at the end.
I dont know if it helps, i could not understand exactly the problem just by the text. Maybe if you share more info (like prints of the data before and after the cross tab) could help.
@Felipe_Ribeir0 its moreso using an analytical app, some months will be 202202, some will be 202202 and 202203 and so on.
The cross tab tool isnt dynamically picking up the chosen months in my initial input.