horseyride
Board Regular
- Joined
- Nov 2, 2017
- Messages
- 82
This should be very simple, but I'm stumped.
I want to add a column by matching the current value of [Last Year-Week] and pulling in the associated [Sales] value
<tbody>
</tbody>
to:
<tbody>
</tbody>
= Table.AddColumn(Source, "Previous Sales", each if [#"Year-Week"] = [Last Year-Week] then [Sales] else 0 )
No idea why this doesn't work
I want to add a column by matching the current value of [Last Year-Week] and pulling in the associated [Sales] value
Year-Week | Last-Year-Week | Sales |
2017-01 | 2016-01 | 100 |
2017-02 | 2016-02 | 200 |
2017-03 | 2016-03 | 300 |
2017-04 | 2016-04 | 400 |
2018-01 | 2017-01 | 500 |
2018-02 | 2017-02 | 600 |
2018-03 | 2017-03 | 700 |
2018-04 | 2017-04 | 800 |
<tbody>
</tbody>
to:
Year-Week | Last-Year-Week | Sales | Previous Sales |
2017-01 | 2016-01 | 100 | null |
2017-02 | 2016-02 | 200 | null |
2017-03 | 2016-03 | 300 | null |
2017-04 | 2016-04 | 400 | null |
2018-01 | 2017-01 | 500 | 100 |
2018-02 | 2017-02 | 600 | 200 |
2018-03 | 2017-03 | 700 | 300 |
2018-04 | 2017-04 | 800 | 400 |
<tbody>
</tbody>
= Table.AddColumn(Source, "Previous Sales", each if [#"Year-Week"] = [Last Year-Week] then [Sales] else 0 )
No idea why this doesn't work