Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
villa1980
Resolver II
Resolver II

If, Text.trimstart and text.end not working in Formula

Hi all,

 I have the below custom column I would like added, however, I am getting a 'Token ',' expected error showing.

 Any ideas what simple thing I am doing wrong 🙂

 

Text.TrimStart (
Text.Contains([POS PARENT DIVISION NAME],"Area ") then text.end([POS PARENT DIVISION NAME],2)
else "99" )

 

Thanks


Alex

1 ACCEPTED SOLUTION
Cookistador
Super User
Super User

Hi @villa1980 

you forgot the if clause

 

The following code should work 🙂

Text.TrimStart(
    if Text.Contains([POS PARENT DIVISION NAME], "Area ")
    then Text.End([POS PARENT DIVISION NAME], 2)
    else "99"
)

 

View solution in original post

2 REPLIES 2
Cookistador
Super User
Super User

Hi @villa1980 

you forgot the if clause

 

The following code should work 🙂

Text.TrimStart(
    if Text.Contains([POS PARENT DIVISION NAME], "Area ")
    then Text.End([POS PARENT DIVISION NAME], 2)
    else "99"
)

 

That is great tank-you so much for the reply, I knew I was missing something so simple

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.