Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dynamically split one table into multiple tables - Query Editor

My data comes in as text files and is structured as follows (Excel data example at this dropbox link: https://www.dropbox.com/s/nittio4xwnfd61x/Data%20Example.xlsx?dl=0😞

 Data Example.jpg

 

There's essentially 3 "data tables" within this one text file. Each one starts at the Header Line. The Header Lines would come in at different rows based on the text file. How can I dynamically split these "data tables" within this one file? There is a specific ID number on the second header line that I need to tag to each "data table" so that's why I need a way to seprate or isolate each one.

 

I know how to extract the ID number. I was thinking to create an index column and filter between header rows or something like that, but wanted to see if there was an approach that I wasn't thinking of that would be cleaner.

7 REPLIES 7
Greg_Deckler
Super User
Super User

Ideally, what are you expecting as output from this? 3 columns, 3 tables or ?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  Thanks for the reply. So I'm importing a number of similar text files from SharePoint. My ideal output is one big table with all the data and one column that represents ID number. 

 

My guess is that the transformation would happen at the "Transform Sample File" step in the SharePoint "Helper Queries" and then when invoking the function to combine all the text files from SharePoint, it would combine all those into one table.

 

Wait, a single table with a single column like:

ID 1
ID 2
ID 3

?

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler In my example the first data grouping has about 25 rows of data. So the end result would have 25 rows with that data and a column with that associated ID number. The next grouping in my example has 7 rows of data. So below the 25 rows explained above would be the 7 rows of data with the different ID number in that ID column. And so on.

 

That's my ultimate goal. I can work on getting there, but I believe my first step would be to somehow split this one table into it's different data groupings. Not sure if there's a way to go from my data to end result easily, but I think if I can at least have the data split into different groupings then I can re-evaluate how best to get to my end result.

Hi @Anonymous ,

 

It's better to give us a complete example data and make an output table in EXCEL, so that we can know your data structure and the results you want.

In addition, if it cannot be implemented in Edit Queries, do you mind using DAX?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-lionel-msft 

 

I have a similar question. The only difference is that I dont want to output multiple tables, but just one. So let me give you a complete example. I have one xlsx file with financial transaction data for multiple companies like this. The first attached image is the exact format as I get the excel file and the next one is the how I want it. 

 

I hope that this will help @Anonymous as well as from this solution he should be able to use the split function to create the separate tables he requires.

 

Before.png

 

And this is what is should look like afterwards:

after.png

Best regards

Hey,

 

Probably you found a way to achieve this. 

 

Do you recall your best approach?

 

Thanks,

Yuvi

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.