cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

M to append queries

I found a really good article about Merging queries using M, instead of having to import all the files then merge, using M you can do it all in one step. https://social.technet.microsoft.com/wiki/contents/articles/32915.power-bi-merge-query-with-m.aspx 

**one thing to note he is missing a "," in his code, but otherwise I tested it works.

 

 

Is it possible to do the same thing Appending queries? I have over 500,000 rows in each quarter and it takes forever to append these queries together. If possible, I would like to do it all at once. 

 

Thank you!!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper II
Helper II

Re: M to append queries

I figured it out, not sure how feasible it since I have about 60 columns in the report. but it works

 

let
Source = Csv.Document(File.Contents("C:\Users\Documents\Development\test\one.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Column1", Int64.Type}, {"Column2", Int64.Type}}),
Source1 = Csv.Document(File.Contents("C:\Users\Documents\Development\test\one.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers1" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers1",{{"Column1", Int64.Type}, {"Column2", Int64.Type}}),

#"Appended Query" = Table.Combine({#"Changed Type", #"Changed Type1",two})
in
#"Appended Query"

View solution in original post

1 REPLY 1
Highlighted
Helper II
Helper II

Re: M to append queries

I figured it out, not sure how feasible it since I have about 60 columns in the report. but it works

 

let
Source = Csv.Document(File.Contents("C:\Users\Documents\Development\test\one.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Column1", Int64.Type}, {"Column2", Int64.Type}}),
Source1 = Csv.Document(File.Contents("C:\Users\Documents\Development\test\one.csv"),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers1" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers1",{{"Column1", Int64.Type}, {"Column2", Int64.Type}}),

#"Appended Query" = Table.Combine({#"Changed Type", #"Changed Type1",two})
in
#"Appended Query"

View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.