Forum Discussion

Alex_G7's avatar
Alex_G7
Helper I
7 years ago
Solved

Replace Data Source of Each Query with Generic Data Source

Hi 

I am selecting from view in my projects 

I want change Data source for all queries to generic Data Source when I will move from dev to prod

 

 

1. I created Blank Query 

DS_AG

usinng Advice editor I specified Source as 

let
Source = Sql.Database("DESKTOP-DJZ12\AGCMS", "PowerBIDX")
in
Source

 

 

In my Existing  Query01  Source  

let
Source = Sql.Database("DESKTOP-DJZ12\AGCMS", "PowerBIDX", [Query="SELECT [DATAAREAID] as LegalEntity,#(lf) [NAME] as LegalEntityName#(lf)FROM [V_CompaniesLegalEntities]"])
in
Source

 

 

 

I   want to replace "DESKTOP-DJZ12\AGCMS", "PowerBIDX"  with DS_AG

 

something  like 

let
Source = Sql.Database("DS_AG", [Query="SELECT [DATAAREAID] as LegalEntity,#(lf) [NAME] as LegalEntityName#(lf)FROM [V_CompaniesLegalEntities]"])
in
Source

 

please help with syntax  or  show example

 

 

 

 

 

  • Hi Alex_G7 ,

     

    Based on my test, we can add parameters firstly in power query. I take SQL Server as an example here as the same as yours.

     

    123.png

     

    Then we can get data and use the Parameter that we created. For more details, please check the online document.

     

    12333.png

2 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi Alex_G7 ,

     

    Based on my test, we can add parameters firstly in power query. I take SQL Server as an example here as the same as yours.

     

    123.png

     

    Then we can get data and use the Parameter that we created. For more details, please check the online document.

     

    12333.png

    • Alex_G7's avatar
      Alex_G7
      Helper I

      Thank ypu 

       its is very simply and wokring solution