Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Everyone
I need to copy multiple queries which are absolutely identical. The only change I make to these queries is the data source. Basically what I do is a copy of the query and then I go in the souce step (in the editor) and change the DB name. In this way I get identical data for the new DB, and I need to repeat this operation many times
What I'd like to have is a dynamic way to retrieve the DB name in a column of my query. So what I'd like to do is add a column which retrieves the DB name from the source, but it has to be dynamic and not hardcoded. In this way each time I copy a query and change the DB name I will retrieve the correct DB name in the column without having to change an hardcoded value
Is it possible? Maybe with parameters or something?
Thanks for any help
Solved! Go to Solution.
Hello @Anonymous
what do you think of using a Variable for you DB-name and using this in the datasource as well as for adding a new column?
Here the code
let
VARDB = "YOURDATABSENAME",
Quelle = Sql.Database(VARDB, "Extension"),
dbo_V_BSM_SummaryReportLarge = Quelle{[Schema="dbo",Item="V_BSM_SummaryReportLarge"]}[Data],
Add = Table.AddColumn(dbo_V_BSM_SummaryReportLarge, "DB-Name", each VARDB)
in
Add
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello @Anonymous
what do you think of using a Variable for you DB-name and using this in the datasource as well as for adding a new column?
Here the code
let
VARDB = "YOURDATABSENAME",
Quelle = Sql.Database(VARDB, "Extension"),
dbo_V_BSM_SummaryReportLarge = Quelle{[Schema="dbo",Item="V_BSM_SummaryReportLarge"]}[Data],
Add = Table.AddColumn(dbo_V_BSM_SummaryReportLarge, "DB-Name", each VARDB)
in
Add
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
I don't have this table in my database.
Perfect!
I have combined this with a parameter and made it even easier to pick my DB (now it's just one click in the parameter list and I have both the correct databse and column populated!)
Thanks a lot
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
54 | |
21 | |
12 | |
11 |