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:
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.
<tbody>
</tbody>
Hope you can help! Thanks in advance!
Alex
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 A | |||||||
Product | Table A: Total Qty | ||||||
a | 323000 | ||||||
b | 898807 | ||||||
c | 844945 | ||||||
d | 36330 | ||||||
e | 281009 | ||||||
f | 611092 | ||||||
g | 633217 | ||||||
Table B | |||||||
Product | Table A: Total Qty | 6/4/2017 | 6/11/2017 | 6/18/2017 | 6/25/2017 | 7/2/2017 | 7/9/2017 |
a | 323,000 | 6,460 | 6,460 | 6,460 | 6,460 | 6,460 | 6,460 |
b | 898,807 | 17,976 | 17,976 | 17,976 | 17,976 | 17,976 | 17,976 |
c | 844,945 | 16,899 | 16,899 | 16,899 | 16,899 | 16,899 | 16,899 |
d | 36,330 | 727 | 727 | 727 | 727 | 727 | 727 |
e | 281,009 | 5,620 | 5,620 | 5,620 | 5,620 | 5,620 | 5,620 |
f | 611,092 | 12,222 | 12,222 | 12,222 | 12,222 | 12,222 | 12,222 |
g | 633,217 | 12,664 | 12,664 | 12,664 | 12,664 | 12,664 | 12,664 |
<tbody>
</tbody>
Hope you can help! Thanks in advance!
Alex