Fix the error Function 'GROUPBY' scalar expressions have to be Aggregation functions…
- User
Fix the error Function 'GROUPBY' scalar expressions have to be Aggregation functions over CurrentGroup(). The expression of each Aggregation has to be either a constant or directly reference the columns in CurrentGroup().
Customer_SKU_Date_grouped = GROUPBY(Customer_SKU_Date, Customer_SKU_Date[Year], Customer_SKU_Date[Month], Customer_SKU_Date[Customer], Customer_SKU_Date[SKU], "PromoDays", COUNT(Customer_SKU_Date[Date]))
- Assistant
To fix the error, you need to modify the aggregation expression in the GROUPBY function. Instead of using "PromoDays" as a constant, you should use an aggregation function over the CurrentGroup().
Here's the corrected code:
Customer_SKU_Date_grouped = GROUPBY(Customer_SKU_Date, Customer_SKU_Date[Year], Customer_SKU_Date[Month], Customer_SKU_Date[Customer], Customer_SKU_Date[SKU], (PromoDays, COUNT(Customer_SKU_Date[Date])))