Michal
Michal

Reputation: 6121

Single query append

I have the following table:

 Month | Perc% | FYTD%
 01/01 |    5% |    5%
 01/02 |   10% |  7.5%
 01/03 |    5% |    6%

I need to re-arrange it to get:

 Month | Perc%
 01/01 |    5%
 01/02 |   10%
 01/03 |    5%
 FYTD  |    6%

At the moment I'm using two tables in Power Query, one for the monthly figures and one for the FYTD figure, joining them to create the desired output table.

How can I do it with a single query?

Upvotes: 0

Views: 30

Answers (1)

davidebacci
davidebacci

Reputation: 30324

enter image description here

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUjAw1DcwVFDSUTJVhRCxOlBRI5CooQFI2FzP1ABJxhiu3gwoGgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, #"Perc%" = _t, #"FYTD%" = _t]),
    Custom1 = Table.Combine( { #"Source", Table.FromRecords({ [Month = "FYTD%", #"Perc%"= List.LastN(Source[#"FYTD%"],1){0}   ]})}),
    #"Removed Columns" = Table.RemoveColumns(Custom1,{"FYTD%"})
in
    #"Removed Columns"

Upvotes: 1

Related Questions