Forum Discussion
Changing text to formula
- 6 years ago
Hi LukaszKoper ,
Try this one for a custom column:
Expression.Evaluate(Text.Replace([Column1], """", ""))
Hi LukaszKoper ,
Try this one for a custom column:
Expression.Evaluate(Text.Replace([Column1], """", ""))
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?
- LukaszKoper6 years agoRegular Visitor
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],"""",""))