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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Return number value before "-" in string

Hi Experts

 

How would you return the number value in the following string (need the left numbers before the "-")

Column                       Result

0 - 1 week                   0

52 - 53 week               52

1 - 6 week                   1 

6 - 7 week                   6

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

I used the formula you mentioned and get the correct result.

vkalyjmsft_0-1657848575533.png

Not sure what error you have got by this formula.

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please considerAccept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team _ kalyj

v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

I used the formula you mentioned and get the correct result.

vkalyjmsft_0-1657848575533.png

Not sure what error you have got by this formula.

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please considerAccept it as the solution to help the other members find it more quickly.

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Let me know how it goes at your end with the solution I have provided above - which is the Power Query way 🙂

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Pragati11
Super User
Super User

Hi @Anonymous ,

 

You can get this transformed in Power Query easily.

I am taking the data as you shared above as follows:

Pragati11_2-1657530472586.png

Now select your column and from the top ribbon Transform --> Extract --> Text Before Delimiter

Pragati11_3-1657530516354.png

A new window appears, where enter your delimiter as "-"  and then click OK

Pragati11_4-1657530561604.png

Finally you get the desired result:

Pragati11_5-1657530618192.png

Hope the solution helps.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi - Have this but is noting working

Sort_Bands = LEFT('reporting Diagnostics_Weekly_Waiting_MDS'[Wait_Bands],FIND("-",'reporting Diagnostics_Weekly_Waiting_MDS'[Wait_Bands])-1)
Anonymous
Not applicable

Hi Pragati 11 - firstly, apologies - this has to be a calculated column... My fault.. I can do this the PQ way...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.