Forum Discussion

ghdunn's avatar
ghdunn
Icon for Helper III rankHelper III
7 years ago
Solved

expression.evaluate - import a snippet .not the whole script

Hi   I have a dataset transformation that is a stable/unchanging set of query steps except for a last conditional column step which is driven by a reasonably volatile set of business rules that I w...
  • v-chuncz-msft's avatar
    7 years ago

    ghdunn,

     

    Add Let expression and see code below.

     

    let #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [country] = "USA" then 1 else if [country] = "UK" then 2 else 3) in #"Added Conditional Column"
    Expression.Evaluate(Source2, Record.Combine({[#"Changed Type"=#"Changed Type"], #shared}))

     

  • v-chuncz-msft's avatar
    v-chuncz-msft
    7 years ago

    ghdunn,

     

    Change it as follows.

     

        Result = Expression.Evaluate(
    in
        Result