Forum Discussion
Please help me.
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.
Expression.Error: The name 'PreviousStepName' wasn't recognized. Make sure it's spelled correctly.
- rubayatyasmin3 years agoCommunity Champion
you need to adjust the PreviousStepName with the actual previous step name of your in the Power Query. the one with the #"queryName" something like that
- Livia_Hernandez3 years agoHelper I
I think I'm just too slow at this... I can usually follow but clearly I'm missing something. I really appreciat your quick response!