Javascript groub Array by different properties

I would like to group a array of objects in JavaScript.

[
  { count: 6, month: 11, type: 'categoryA', year: 2022 },
  { count: 5, month: 12, type: 'categoryA', year: 2022 },
  { count: 10, month: 1, type: 'categoryA', year: 2023 },
  { count: 5, month: 1, type: 'categoryC', year: 2023 },
  { count: 26, month: 2, type: 'categoryA', year: 2023 },
  { count: 10, month: 2, type: 'categoryC', year: 2023 },
  { count: 2, month: 3, type: 'categoryA', year: 2023 },
  { count: 31, month: 3, type: 'categoryA', year: 2023 },
  { count: 8, month: 3, type: 'categoryB', year: 2023 },
  { count: 7, month: 4, type: 'categoryA', year: 2023 },
  { count: 4, month: 4, type: 'categoryB', year: 2023 }
]

I want to get the Count of categoryA and categoryC per month and year.

[
  { count: 6, month: 11, type: 'categoryA_and_CategoryC', year: 2022 },
  { count: 5, month: 12, type: 'categoryA_and_CategoryC', year: 2022 },
  { count: 15, month: 1, type: 'categoryA_and_CategoryC', year: 2023 },
  { count: 36, month: 2, type: 'categoryA_and_CategoryC', year: 2023 },
  { count: 2, month: 3, type: 'categoryA_and_CategoryC', year: 2023 },
  { count: 31, month: 3, type: 'categoryA_and_CategoryC', year: 2023 },
  { count: 8, month: 3, type: 'categoryB', year: 2023 },
  { count: 7, month: 4, type: 'categoryA_and_CategoryC', year: 2023 },
  { count: 4, month: 4, type: 'categoryB', year: 2023 }
]

I found no smart way to do the grouping and maybe someone has an idea to implement it in a elegant way.