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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors