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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

use of "LEFT() or RIGHT()" type functions in Query Editor / Custom Column

I'm trying to add a column in the query editor by using an if-then statement based on the left x characters of one of the other columns in my table. When I use a nested if statement in the table itself and add the custom field, this seems to work using yet this does not seem to work when adding a custom column in the query editor environment. Here's what I've tried:

 

if left(column,5)="abcde" then "a" else "b"

 

I realise I could work with adding the column outside the query editor, but I'd like to understand how to use the function inside it as well. 

 

thanks

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@Anonymous  Functions in DAX and M-Language (Power Query) are different.

 

You need to use as below in Power Query Editor as custom column

 

if Text.Start(column,5) = "abcde" then "a" else "b" 

 

if Text.End(column,2) = "de" then "d" else "e" 




Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

1 REPLY 1
PattemManohar
Community Champion
Community Champion

@Anonymous  Functions in DAX and M-Language (Power Query) are different.

 

You need to use as below in Power Query Editor as custom column

 

if Text.Start(column,5) = "abcde" then "a" else "b" 

 

if Text.End(column,2) = "de" then "d" else "e" 




Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




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.

Top Solution Authors
Top Kudoed Authors