Forum Discussion
Count n'th delimiter value
OK, I just created a new step to replace the errors with "0" and this seems to have fixed the issue, unless you know of an additional issues this method may cause?
You omit "?" operator in Text.StartsWith(_, dd)){0}?
It evaluates to null if the index is out of range.
- StuartSmith2 years ago
Power Participant
I still can't figure out the correct code to take into account if a date isnt present. The current code is...
#"Added Custom1" = Table.AddColumn(#"Changed Type2", "nr", each let dd = DateTime.ToText(DateTime.LocalNow(), "dd") in Text.RemoveRange(List.Select(Text.Split([Region Attrition],";"), each Text.StartsWith(_, dd)){0}, 0, 3)?? "N/A"),
and produces the error...
Expression.Error: There weren't enough elements in the enumeration to complete the operation.
Details:
[List]I have tried...
each Text.StartsWith(_, dd)){0}, 0, 3) "N/A"),
each Text.StartsWith(_, dd)){0}, 0, 3) N/A),each Text.StartsWith(_, dd)){0}, 0, 3)),
But still get the above error.
RESOLVED: Additionally, currently your code get todays date number and then pulls the corrosponding value from the staffing column. Is it possible to also have a column that is today -1, so the previous day from today. Hope that makes sence. RESOLVED
- ThxAlot2 years ago
Super User
#"Added Custom1" = Table.AddColumn(#"Changed Type2", "nr", each let dd = DateTime.ToText(DateTime.LocalNow(), "dd") in Text.RemoveRange(List.Select(Text.Split([Region Attrition],";"), each Text.StartsWith(_, dd)){0}?, 0, 3)?? "N/A")- StuartSmith2 years ago
Power Participant
ThxAlot for all your help 🙂