Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
perpor
Helper V
Helper V

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

1 ACCEPTED SOLUTION
deldersveld
Resident Rockstar
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"

View solution in original post

4 REPLIES 4
deldersveld
Resident Rockstar
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"

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

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

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.