Forum Discussion
How to expand nested list within specific column?
- 5 years ago
AVS218 - this seems to be a relatively simple if/then/else construct. Why are you embeddding everyting in a list? Just change the Start Year column to this:
if [Count] = 1 then if [Custom] = 1 then [Contract Start Date] else Date.AddYears([Contract Start Date],[Custom]-1) else [Contract Start Date]If there is some reason you want to keep creating lists just to extract from them, then you could do this:
#"Start Year (Nested)" = Table.AddColumn( #"Changed Type1", "Start Year", each if [Count] = 1 then {if [Custom] = 1 then {[Contract Start Date]} else {Date.AddYears([Contract Start Date],[Custom]-1)}}{0}{0} else {[Contract Start Date]}{0} )
But it is the same result, with more work. Don't use squiggly brackets unless you definitely need to create a list. Here, you definitely do no need to do that.
AVS218 - this seems to be a relatively simple if/then/else construct. Why are you embeddding everyting in a list? Just change the Start Year column to this:
if [Count] = 1 then if [Custom] = 1 then [Contract Start Date] else Date.AddYears([Contract Start Date],[Custom]-1) else [Contract Start Date]
If there is some reason you want to keep creating lists just to extract from them, then you could do this:
#"Start Year (Nested)" =
Table.AddColumn(
#"Changed Type1",
"Start Year",
each
if [Count] = 1 then
{if [Custom] = 1 then {[Contract Start Date]} else {Date.AddYears([Contract Start Date],[Custom]-1)}}{0}{0}
else {[Contract Start Date]}{0}
)
But it is the same result, with more work. Don't use squiggly brackets unless you definitely need to create a list. Here, you definitely do no need to do that.