Forum Discussion
Passing Parameter to warehouse
- 1 year ago
Hi AG_PBI ,
Thank you for your questions. I’d like to clarify a few points regarding your setup:
- The variable name you choose (e.g., wsId or ConnectionString) does not impact functionality as long as it is used consistently throughout your queries. The key is to ensure that the value assigned accurately reflects the connection string for your environment (Dev or Prod). You appear to be using the server information from the semantic model correctly, but please ensure that the connection strings in your parameters match the server details for each environment.
- The Current Value setting in Power BI Desktop specifies which value the parameter will use during development. Once published to the Power BI service, you can override this Current Value with a different setting for the same parameter. This flexibility allows you to maintain a single PBIX file while managing different environments (Dev and Prod) within the service.
- Setting the Env parameter directly in the Power BI service will take precedence over the value set in the PBIX file during report refreshes. This is particularly useful for managing deployments without needing to republish the PBIX file.
- If removing the if statement resolved your refresh errors, it indicates that the parameter setup in the service was not compatible with the logic in your query. By directly using IDs for Dev and Prod, you have simplified the logic, which can streamline your workflow.
- The parameters defined in the PBIX file and the settings in the Power BI service can interact, but the service settings will override the parameters in the PBIX. For example, if you publish a PBIX with a Current Value set to DevId but later change the Env parameter in the service to ProdId, the service will utilize ProdId for refreshes.
I hope this addresses your concerns. If you have any further questions or need additional assistance, please do not hesitate to ask. Kindly Accept this as a solution and give it a “Kudos” so others can find it easily.
Thank you.
Hello AG_PBI - The problem is the if statement in your source query. If you want to parameterize the data source depending on the stage (Dev/Prod), you could skip the evaluation and just use a parameter for the connection string. Alternatively, you could create a new semantic model from within the lakehouse and then use deployment pipelines to deploy the warehouse and additional semantic model from Dev to QA and Prod. The warehouse and model stay connected without needing parameters at all. If this method will not work for you can you please provide some additional information explaining why and I'll be glad to help more.
- AG_PBI1 year agoFrequent Visitor
Hi jennratten, Thanks for your reply. We are using different workspaces cause we are assigning different space even for the transitions instead of just the semantic models. Can you please elaborate how to use a parameter for the connection string?