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

union all tables using M with wildcard selection

Hi 

 

I have managed to automate the import of multiple tabs in an Excel spreadsheet that prefix with 'Date' 🙂

 

let
      Source = Excel.Workbook(File.Contents("C:\Users\mbo06\OneDrive - MyPharma\MMCL - PowerBI\ForecastvsBudget - PowerBI.xlsx"), null, true),
     #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name], "Date"))
in
     #"Filtered Rows"

 

Now, I need to union all tables together do that I see all data columns for all of the tables. Can anyone help with M functions? 

5 REPLIES 5
edhans
Super User
Super User

Just use Table.Combine().

 

Table.Combine(Table1, Table2, #"Some other table name", Table4)

 

That will append 4 tables into one. All columns will be visible from all tables. Any columns in one table not in another will result in null showing up in the other tables.

 

By default Table.Combine is Union All. To get a normal union, you'd need to follow up with Table.Distinct().

 

The Combine operation is what you might want to use, but it is only designed to combine identical tables. It doesn't handle different tables with different columns. 

If you need more help, please share some data.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Thanks for getting back to me. How do I union all using a wildcard for 'Date'?

 

I tried this and it did not work

 

let
      Source = Excel.Workbook(File.Contents("C:\Users\mbo06\OneDrive - MyPharma\MMCL - PowerBI\ForecastvsBudget -              PowerBI.xlsx"), null, true),
     #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name], "Date"))
     ,Table.Combine= ( each Text.StartsWith([Item], "Date"))
in
#"Filtered Rows"

Anonymous
Not applicable

screenshot.JPG

 

Again, if you need further help, please provided sample data. Otherwise I am just guessing as to what will work and we will go back and forth.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Sorry - I count see an option to share files / data. Are you able to access here : https://github.com/ametsanalytics/ExcelFiles

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.