March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
164 | |
116 | |
63 | |
57 | |
50 |