Forum Discussion

10500438's avatar
10500438
Helper II
6 years ago
Solved

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!!

  • 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"

1 Reply

  • 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"