Forum Discussion
custom column in M query
- 10 years ago
try this:
if Text.End( Text.Upper( [Group] ), 1) = "S"
then "A"
else "B"
try this:
if Text.End( Text.Upper( [Group] ), 1) = "S"
then "A"
else "B"
- majdkaid2210 years ago
Helper V
thanks ImkeF
for me personal knowledge, why the ,1 made the difference? the goup column is text, hence I thought what I did was right
Thanks mate
Majd
- ImkeF10 years ago
Community Champion
This is a syntax-error in the Text.End-formula (second argument need to be the number of letters to be returned - LinkToRessource) as well as in the conditional statment (when you use an if you need to combine it with an operator/comparer - LinkToRessource).
- Anonymous10 years agoNot applicable
Text.End will return the last n characters of a string. You have to tell it how many you want. If you leave off that number it will give you an error because you didn't finish writing the entire formula. Text.End( Text.Upper( [Group] ), 1) returns the last character. Text.End( Text.Upper( [Group] ), 2) would return the last 2 characters, Text.End( Text.Upper( [Group] ), 7) the last 7 characters, etc.