Power Query - Append Variable Dates to Existing Table as Headers

alexb523

Board Regular
Joined
Dec 12, 2013
Messages
115
I am having an issue w/ my below M Code. I have set up an simple example of what i am trying to do below, but know the issue is when try to append variable dates as headers into the table:

Code:
let
Set up steps.
.
.
.
    #"Appended Query" = Table.Combine({#"Removed Other Columns",Table.PromoteHeaders(Table.Transpose(Table.FromList(List.Dates(Date.StartOfWeek(DateTime.Date(DateTime.LocalNow()),  Day.Sunday), 52, #duration(7,0,0,0)), Splitter.SplitByNothing(), {"Dates"}, null, ExtraValues.Error)),[PromoteAllScalars=true])})
in
    #"Appended Query"

Code:
Error:
Expression.Error: 2 arguments were passed to a function which expects 1.
Details:
    Pattern=
    Arguments=List


The table starts like table A. I use some simple query functions to get to this point. But I need to add the columns w/ dates and the function (Table A: Total Qty/50) for all added date columns as in Table B.

[TABLE="width: 576"]
<tbody>[TR]
[TD]Table A[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Product[/TD]
[TD]Table A: Total Qty[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD="align: right"]323000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD="align: right"]898807[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]c[/TD]
[TD="align: right"]844945[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]d[/TD]
[TD="align: right"]36330[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]e[/TD]
[TD="align: right"]281009[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]f[/TD]
[TD="align: right"]611092[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]g[/TD]
[TD="align: right"]633217[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Table B[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Product[/TD]
[TD]Table A: Total Qty[/TD]
[TD="align: right"]6/4/2017[/TD]
[TD="align: right"]6/11/2017[/TD]
[TD="align: right"]6/18/2017[/TD]
[TD="align: right"]6/25/2017[/TD]
[TD="align: right"]7/2/2017[/TD]
[TD="align: right"]7/9/2017[/TD]
[/TR]
[TR]
[TD]a[/TD]
[TD] 323,000[/TD]
[TD] 6,460[/TD]
[TD] 6,460[/TD]
[TD] 6,460[/TD]
[TD] 6,460[/TD]
[TD] 6,460[/TD]
[TD] 6,460[/TD]
[/TR]
[TR]
[TD]b[/TD]
[TD] 898,807[/TD]
[TD] 17,976[/TD]
[TD] 17,976[/TD]
[TD] 17,976[/TD]
[TD] 17,976[/TD]
[TD] 17,976[/TD]
[TD] 17,976[/TD]
[/TR]
[TR]
[TD]c[/TD]
[TD] 844,945[/TD]
[TD] 16,899[/TD]
[TD] 16,899[/TD]
[TD] 16,899[/TD]
[TD] 16,899[/TD]
[TD] 16,899[/TD]
[TD] 16,899[/TD]
[/TR]
[TR]
[TD]d[/TD]
[TD] 36,330[/TD]
[TD] 727[/TD]
[TD] 727[/TD]
[TD] 727[/TD]
[TD] 727[/TD]
[TD] 727[/TD]
[TD] 727[/TD]
[/TR]
[TR]
[TD]e[/TD]
[TD] 281,009[/TD]
[TD] 5,620[/TD]
[TD] 5,620[/TD]
[TD] 5,620[/TD]
[TD] 5,620[/TD]
[TD] 5,620[/TD]
[TD] 5,620[/TD]
[/TR]
[TR]
[TD]f[/TD]
[TD] 611,092[/TD]
[TD] 12,222[/TD]
[TD] 12,222[/TD]
[TD] 12,222[/TD]
[TD] 12,222[/TD]
[TD] 12,222[/TD]
[TD] 12,222[/TD]
[/TR]
[TR]
[TD]g[/TD]
[TD] 633,217[/TD]
[TD] 12,664[/TD]
[TD] 12,664[/TD]
[TD] 12,664[/TD]
[TD] 12,664[/TD]
[TD] 12,664[/TD]
[TD] 12,664[/TD]
[/TR]
</tbody>[/TABLE]




Hope you can help! Thanks in advance!
Alex
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top