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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors