I have a table with multiple work_weeks, product_names, and event_names. Here's an example:
work_week product_name event_name num_products attributeA attributeB
2021-17 A Event1 25 Y X
2021-17 A Event1 20 Y Z
2021-17 A Event1 15 N Y
I'm trying to perform a 'group by' on this table, so I can get the sum of num_products grouped by work_week, product_name, and event_name. However, in my 'group by' table, I need several versions of sum(num_products) depending on the values of attributeA and attributeB. Something like this:
work_week product_name event_name sum_when_A = N sum_when_A = Y and B = Z
2021-17 A Event1 15 20
Any ideas on how to execute this?