Search code examples
powerbim

evaluating a textual equation into a number


AS a newbie to m I still can't get my head around it. Here is the query I have. It's gone through a number of steps to get to the below. How do I use Expression.Evaluate against the whole query against the column EntryFee, which for the sake of simplicity the query is called #"Nearly There". I want to Evaluate the entire column Entry Fee. To reiterate it needs to be done in Power Query "M"

Snapshot of table/query

snapshot of query


Solution

  • You can either add a new custom column with the code

    Expression.Evaluate([Entry Fee])
    

    or do a column transformation

    = Table.TransformColumns(#"Nearly There", {{"Entry Fee", Expression.Evaluate, type number}})
    

    To generate this step, you can select the column and then Transform tab > Format > Trim and then replace Text.Trim with Expression.Evaluate in the generated code.