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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
alwright
New Member

If left starts with this, return this

Very new to Power BI and Power Query.  I have a column A with values that look like this: (0102) and (0506), etc.  I want a column B labled "Region" where, if column A starts with "(01" then column B spits out "Region 1".  If column A is "(05", then column B is "Region 5".  How would I do that?

 

Thank you.

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi, I try to explain as simple as possible:

 

A.) Extract fisrt 2 characters

dufoq3_1-1714758010326.png

Enter 2

 

B.) 

dufoq3_2-1714758077892.png

 

 

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

4 REPLIES 4
dufoq3
Super User
Super User

Hi, I try to explain as simple as possible:

 

A.) Extract fisrt 2 characters

dufoq3_1-1714758010326.png

Enter 2

 

B.) 

dufoq3_2-1714758077892.png

 

 

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

This was exactly what I was looking for, thank you!  And thank you for keeping it simple, I really appreciate it.

You're welcome. 😉


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Vijay_A_Verma
Super User
Super User

Put following formula in a custom column

[a = Text.ToList([Column A]), b = if a{0} = "(" and a{1} = "0" and Value.FromText(a{2}) is number then "Region  " & a{2} else null] [b]

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors