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
LukaszKoper
Regular Visitor

Changing text to formula

Hello,

 

 

With substring function i changed text from "6x40HQ,1x20" to "6*76+1*33". Now I would like to execute this "6*76+1*33" as a formula.

 

Best Regards,

Lukasz Koper

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @LukaszKoper ,

 

Try this one for a custom column:

Expression.Evaluate(Text.Replace([Column1], """", ""))

 

Capture.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @LukaszKoper 

 

 if the above posts help, please kindly mark it as a solution to help others find it more quickly. If not, please kindly elaborate more. thanks!

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User
camargos88
Community Champion
Community Champion

Hi @LukaszKoper ,

 

Try this one for a custom column:

Expression.Evaluate(Text.Replace([Column1], """", ""))

 

Capture.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



To elaborate I have a column (container-typ) imported from excel that has values like:

20

40

40HQ

40HC

4x40HQ,1x20

 

Those are types of containers and f.e container type 20 has volume of 33 m^3, 40HQ has volume of 76m^3

 

In DAX I use this querry

 

SUBSTITUTE (SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE( SUBSTITUTE ([Container-typ], "x", "*"),"20", 33),"40HQ",76),"40HC",76),"40",67),",","+"),"LCL",""),"DDP","")

 

 

to change container type to the volume it has and change expresions like 4x40HQ,1x20 to somethig that looks like formula 4*76+1*33.

In Custom Column I would have to use powerquerry-m. My question is how to change DAX querry to powerquerry-m to get the same effect and how to then run it like a formula?

 

Ok got it Thank You @camargos88 !
I used custom columns, first with this querry 

 
=Text.Replace (Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace(Text.Replace( Text.Replace ([#"Container#(lf)-typ"], "x", "*"),"20", "33"),"40HQ","76"),"40HC","76"),"40","67"),",","+"),"LCL",""),"DDP","")


then this querry

=Expression.Evaluate(Text.Replace([Volume],"""",""))

 


 
 
 
 
 
 

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.