Forum Discussion

Analitika's avatar
Analitika
Post Prodigy
4 years ago

How automatically get database name in Power BI?

Hi,

 

I would like to get database name and add it to table as separate column. Let's say having table and adding new column within that used database.

1 Reply

  • Hi,

     If you use parameter to store the Servername and DBname then you can refer the parameter in the new column to get the database name. 

     

     

    If you use SQL server then you can use below script in new query and get the database name.

     

    let
    Source = Sql.Database("ServerName", "AdventureWorks2019", [Query="SELECT DB_NAME()"])
    in
    Source

     

    Thanks

    Hari