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
hidenseek9
Post Patron
Post Patron

Is there a way to extract certain words out?

Hello Power BI Community!

 

I have a question regarding DAX expression.

I have a dummy data below.

In the file, I have a data with names of products and weight out of each product in text.

 

DummyData

 

What I would like to do is to extract just the text on weights (i.e. 75GX4PX6)

Then I would like to calculate the weight of the total product. (i.e. 75*4*6= 1,800)

 

However, the weight in the text is not listed in a consistant format or

a length of characters is not always the same.

 

Is there a way to extract just the weight text?

Or a direct way to calculate the total weight?

 

Many thanks,

 

H

1 ACCEPTED SOLUTION

It depends.

 

If the pack size is always the third number, then you can adjust the "Product" step to have only the first 2 values multiplied.

 

    Product =               Table.TransformColumns(NumberFrom,{{"Weight", each List.Product(List.FirstN(_,2))}}),

 

Otherwise I'm curious how you are going to create the column with the number of packs per case.

Specializing in Power Query Formula Language (M)

View solution in original post

10 REPLIES 10

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.