Forum Discussion

perpor's avatar
perpor
Helper V
9 years ago
Solved

Power BI advaced query Editor

good morning

 

I am searching if it possible to use variables, in the advanced query editor, something like this:

 

instead of:

------------

 

let
Origine = Sql.Database("99.99.99.99", "Mydb", [Query="select data from mytab where code = 66....

 

in

Origine

 

something like this:

---------------------

 

let variab = 66;

 

let
Origine = Sql.Database("99.99.99.99", "Mydb", [Query="select data from mytab where code = variab .....

 

in

Origine

 

or any doc about ...

 thanks

  • Yes, just add the named variable in a previous step, for example:

     

    let
        myVar = "66",
        Source = "myUrl" & myVar
    in
        Source

     

     

    This returns "myUrl66"

4 Replies

  • deldersveld's avatar
    deldersveld
    Resident Rockstar

    Yes, just add the named variable in a previous step, for example:

     

    let
        myVar = "66",
        Source = "myUrl" & myVar
    in
        Source

     

     

    This returns "myUrl66"

    • perpor's avatar
      perpor
      Helper V

      thanks, it works... (the best would be to have global variables, for all the report, but this is already helpful..)