Forum Discussion
Please help me.
Thanks! @ rubayatyasmin - I understand what you are suggesting but - this will not solve my issue as I'm dealing with 7 years of data and million plus customers. I need to group them by number of orders. I don't want an average of how much each one spent. I need to know how many customers bought 2 times - 50 times etc. I can't use "GERScustomercode" in anytype of visualization. Make sense?
need to perform some data transformation steps to group the customers by the number of orders they made. Go to the "Transform Data" (Power Query Editor) view.
a. Add Custom Column: Click on "Add Column" in the Power Query Editor. Then, use the following M code to calculate the number of orders for each customer:
= Table.AddColumn(#"PreviousStepName", "NumberOfOrders", each List.Count(Table.SelectRows(#"PreviousStepName", each [GERSCustomerCode] = [GERSCustomerCode])))
emove Duplicates: After adding the custom column, you may have duplicate rows in the table. Remove duplicates based on the "GERSCustomerCode" column, keeping only the "NumberOfOrders" column.
c. Group By: Now, go to the "Home" tab in the Power Query Editor and click on "Group By." Group by the "NumberOfOrders" column and count the number of unique customers in each group.