Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi all,
I have imported a folder with 150 excel files. I would like to import also the ROW NUMBER for each line of each excel file, so that I get an index column such as :
EXCEL FILE | ROW NUMBER |
001 | 1 |
001 | 2 |
001 | 3 |
002 | 1 |
002 | 2 |
002 | 3 |
003 | 1 |
003 | 2 |
and so on.
Any idea on how I do this?
Thanks in advance,
Ana
Solved! Go to Solution.
Hi @AFra ,
sure, here is the screenshot:
And also link to file below:
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @AFra ,
if you use the Import from folder - functionality then you should have a query where you transform the data from a sample file. This query is "married" to an automatically generated function which is applied to every row/file within your folder before expanding all the values.
Go to this query and add an index column in there.
This will create what you've requested.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @ImkeF , I tried what you suggested, but it doesnt fully work 😕
I have an index column, but it displays a unique number per excel file. For each file (in the picture 11 Angles and ABC are files) I would need an index, from 1 to 200 (because each file contains 200 rows).
Any ideas?
Hi @AFra ,
yes, that's not the right place to add the index column.
It has to sit in the function that your'e executing in the step before:
Find out where it comes from and add the index in there.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Thanks a lot @ImkeFfor your help, but I don't understand what you mean by "it has to sit it the function". I tried to execute the index function before in the steps, but it doesn't change anything. would you be kind enough to show me how to do it? here's a sample of the files (they should be in a folder) : https://we.tl/t-xJiXZIVMvt
Hi @AFra ,
sure, here is the screenshot:
And also link to file below:
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Thanks a 10000 times!
Hi @amitchandak, thank you for your response.
I was wondering if there is any possibility to create an index column based on the folder name, so that the count of rouws starts at 1 at every change of name folder. Do you know if it's possible?
@AFra , I think @ImkeF , may provide a solution for this
@ImkeF , can you help with this
@AFra , You might have to create a new column of row number in excel for that. As in the case of folder, transformation is post-merge
In power bi You can add index column https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
89 | |
87 | |
82 | |
64 | |
49 |
User | Count |
---|---|
124 | |
110 | |
88 | |
68 | |
66 |