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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Analitika
Post Prodigy
Post Prodigy

Adding column with database name in Power BI

I would like to ask how to add a column in table that contains database name value.

Source is described like this:  Source = Sybase.Database("125.25.25.98", "db_name").

db_name will be as value in a new column.

 

 

1 ACCEPTED SOLUTION

Hi @Analitika ,

Seems like you have misunderstood something in Power Query.

When you connect to the source, for example, Sybase.Database("125.25.25.98", "db_name"), it would return a table, the parameter in the function is written by you or use the parameter list. Power Query would not have the function which could extracrt the function value from another function as far as I know.

 

If you want to create the custom column with database name dynamically, you can try to create a databasename parameter list and use them in the database function, when you create a custom column, the value just need to equal to the parameter's name.

vyingjl_0-1654827939918.png

Source = sql.database(server name, databasename parameter)

vyingjl_1-1654828032155.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
Vijay_A_Verma
Super User
Super User

Use a variable to hold your db name and pass this variable in your Source. Like this

db_name_Var = "abc",
Source = Sybase.Database("125.25.25.98", db_name_Var),

 

Then you can insert a custom column with following formula

=db_name_Var

Do I need previously to create a function holding that variable?

No need to create a function. Either you can assign this variable in the code as I have shown or you can also create a parameter. Parameter is useful is you keep changing this value. If you are not changing the value, better to assign the value to variable in the code.

How make it via transform data? And I need make it dynamically. I mean table first step is source. So I need to extract db name from source then I need to use it for creating additional column.

Hi @Analitika ,

Seems like you have misunderstood something in Power Query.

When you connect to the source, for example, Sybase.Database("125.25.25.98", "db_name"), it would return a table, the parameter in the function is written by you or use the parameter list. Power Query would not have the function which could extracrt the function value from another function as far as I know.

 

If you want to create the custom column with database name dynamically, you can try to create a databasename parameter list and use them in the database function, when you create a custom column, the value just need to equal to the parameter's name.

vyingjl_0-1654827939918.png

Source = sql.database(server name, databasename parameter)

vyingjl_1-1654828032155.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.