Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Nice day
I come to your aid with the following situation.
I have a text file with the following structure
In column A (ID) an identification number is related, in column B (Support) the name of the support that each ID has is related, in column C (TYPE) a number assigned according to the type of support is related, in column D (Account) an account number assigned to each ID is related.
My goal is to get columns E (Quantity) and F (Result).
In column E (Quantity) consecutive number is placed according to the number of media types for each ID and for each type of support. I get this amount in Excel with the function "=IF(A2=A1;IF(C2=C1; E1+1;1);1)" and column F (Result) relates the reslutado I want, which I obtain by concatenating columns D, C and E.
I tried to perform this procedure in the Power Query editor but I couldn't find a way to get the same result but I couldn't find a way.
I appreciate any help you can offer me.
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 53 | |
| 42 | |
| 34 | |
| 34 | |
| 21 |
| User | Count |
|---|---|
| 143 | |
| 125 | |
| 100 | |
| 81 | |
| 63 |