Reply
Highlighted
Member
Posts: 86
Registered: ‎04-13-2017
Accepted Solution

Power BI advaced query Editor

[ Edited ]

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


Accepted Solutions
Established Member
Posts: 257
Registered: ‎06-26-2015

Re: Power BI advaced query Editor

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

 

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

 

 

This returns "myUrl66"

View solution in original post


All Replies
Established Member
Posts: 257
Registered: ‎06-26-2015

Re: Power BI advaced query Editor

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

 

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

 

 

This returns "myUrl66"

Member
Posts: 86
Registered: ‎04-13-2017

Re: Power BI advaced query Editor

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

Established Member
Posts: 257
Registered: ‎06-26-2015

Re: Power BI advaced query Editor

Try looking into parameters. They can be used across queries.

Super Contributor
Posts: 2,281
Registered: ‎09-27-2016

Re: Power BI advaced query Editor

Hi @perpor,

If you have resolved your issue according the helpful reply, please mark it as answer, so other people can find workaround clearly.

Thanks,
Angelia