Forum Discussion

Justas4478's avatar
Justas4478
Post Prodigy
2 years ago
Solved

Text.start with if statment

Hello, I have this M code for power query.
Text.Start([Day of Week Name],3)
I an trying to add if statment that if text says Thursday then do 5 caracters instead of 3.
I think it is simple thing to do but I am not familiar with M code.

3 Replies

  • I manage to get it to work with this:
    if [Day of Week Name] = "Thursday" then Text.Start([Day of Week Name],5) else Text.Start([Day of Week Name],3)
    But I think there is better and shorter way to write this code.
    If anyone has better solution please let me know.