Skip to content
Advertisement

How to handle aggregate function in Case statements when it involves date columns

I’m calculating invoiceDate vs currentDate then sum Value/Amount column grouping by Customer but its returning “invoiceDate is not contained in either an aggregate function or the GROUP BY clause”

Advertisement

Answer

You want conditional aggregation:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement