Forum Discussion
Formula emulation
To achieve the same result in Power Query Editor, you can follow these steps:
Load the text file into Power Query Editor by going to "Data" tab and selecting "From Text/CSV".
In the "Navigator" pane, select the file and click on "Edit".
In the Power Query Editor, go to "Add Column" tab and select "Conditional Column".
In the "Conditional Column" dialog box, create a new column named "Quantity" and enter the following formula:
= if [ID] = #"Previous Row"[ID] then if [Support] = #"Previous Row"[Support] then #"Previous Row"[Quantity] + 1 else 1
else 1
5. This formula checks if the ID and Support in the current row are the same as the previous row. If they are, it increments the Quantity by 1. Otherwise, it resets the Quantity to
6. Click "OK" to create the new column "Quantity".
7. Go to "Add Column" tab again and select "Custom Column".
8. In the "Custom Column" dialog box, create a new column named "Result" and enter the following formula:
= [Account] & "-" & Text.From([TYPE]) & "-" & Text.From([Quantity])
9. This formula concatenates the Account, TYPE, and Quantity columns into a single string
10. Click "OK" to create the new column "Result".
11. Finally, go to "Home" tab and select "Close & Load" to load the data into Excel.
The resulting table should have the same structure and values as the one you created in Excel.
Hello good afternoon
Unfortunately I did not achieve the result with the instructions you gave me even though they were very clear.
The point I am interested in understanding and knowing how to do is 4.
In the Formula Emulation file.xlsx, with the Excel sheets containing the base with the function I currently use, the Source sheet with the data from the txt file, and the Output sheet which is basically a query generated from the Source sheet.
With the above I hope you can help me by performing step 4 to be able to interpret the formula and understand how it works.
Thank you.