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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jaryszek
Post Prodigy
Post Prodigy

2 datasets or parameters to upload report within customer tenant?

Hi Guys,

I will be uploading reports using service principal on Customer tenant. 

And now I have switcher while using report internally within my Team - parameter to change Local Data Source (CSV files) or Cloud Data Source (Github). 

Now when i will publish to customer i do not want to use both of them. I want to use CustomerDatabase for data. 

What is the best practice in this case?
Should i create 2 datasets and modify power query adequantly? It would be more difficult to handle 2 datasets. 

Or i need to include some kind of parameter and while embedding set up it to "Customer1" and within power query change data source? 

But if this report would be refreshable on Customer Side? I will not have any GitHub or CSV gateways on customer side? 
How you would solve the problem?

Best,
Jacek

1 ACCEPTED SOLUTION

Hi @jaryszek ,

 

As i suggested above, avoid relying on parameter switching at runtime.

 

  • Power BI evaluates all branches of the if condition during dataset refresh (even unused ones), so just having CSV logic in the query causes refresh to fail, unless it's a cloud-accessible file.
  • A data gateway is always required for on-prem SQL Server, regardless of whether conditional logic is used.
  • To completely avoid issues, try to maintain consistency across every environment with respect to data sources to avoid failures in the higher environments as well.

Could you please let us know if you have any additional questions?

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thank you!!

View solution in original post

6 REPLIES 6
v-sathmakuri
Community Support
Community Support

Hi @jaryszek ,

 

I hope this information provided is helpful. Feel free to reach out if you have any further questions or would like to discuss this in more detail. If responses provided answers your question, please accept it as a solution so other community members with similar problems can find a solution faster.

 

Thank you!!

v-sathmakuri
Community Support
Community Support

Hi @jaryszek ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

 

Thank you!!

v-sathmakuri
Community Support
Community Support

Hi @jaryszek ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

v-sathmakuri
Community Support
Community Support

Hi @jaryszek ,

Thank you for reaching out to Microsoft Fabric Community.

 

As a best practice, avoid relying on parameter switching at runtime through embedding if the customer will be handling dataset refresh. This is because data source connections need to be clearly defined and stable ahead of time for scheduled refresh and gateway configuration to work correctly.

 

It is also recommended to avoid maintaining multiple source types within a single published version. Instead, include only the data source relevant to the target environment.

 

However, if you do need to support multiple data sources during development, you can consider the following approach.

  • Create a parameter in Power BI called Environment with values like "Team" and "Customer".
  • In Power Query, use this logic:

let
Environment = Parameter_Environment,

Source = if Environment = "Team" then
Csv.Document(File.Contents("ExcelPath"))
else if Environment = "Customer" then
Sql.Database("CustomerDBServer", "CustomerDB")
else
error "Unsupported environment"
in
Source

  • Before publishing to the customer, Set Environment = "Customer"
  • Remove the Team-related (CSV/GitHub) data source steps to avoid refresh issues.
  • Publish the cleaned dataset to their tenant using your Service Principal.
  • On the customer side, they should configure the database gateway for refresh

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos", I’d truly appreciate it! 

 

Thank you!!

Thank you,

few questions:

let
Environment = Parameter_Environment,

Source = if Environment = "Team" then
Csv.Document(File.Contents("ExcelPath"))
else if Environment = "Customer" then
Sql.Database("CustomerDBServer", "CustomerDB")
else
error "Unsupported environment"
in
Source

 1. 

  • Remove the Team-related (CSV/GitHub) data source steps to avoid refresh issues. --> the query example which you provided is staying there? oit should not have issue with 
    2. having this if statement will not invoke refreshing data source error in power bi service :
    "You can't schedule refresh for this semantic model because the following data sources currently don't support refresh" ?
    3. 
  • Remove the Team-related (CSV/GitHub) data source steps to avoid refresh issues --> if this step is required? It means removing all data sources all the time which is time consuming...
    4. If your solution still require to install gateway on Customer VM side? (it shouldnt but like i described in topic below, it is requring gateway still!)

    I described your proposition here:
    https://community.fabric.microsoft.com/t5/Developer/bd-p/Developer

    Best,
    Jacek

Hi @jaryszek ,

 

As i suggested above, avoid relying on parameter switching at runtime.

 

  • Power BI evaluates all branches of the if condition during dataset refresh (even unused ones), so just having CSV logic in the query causes refresh to fail, unless it's a cloud-accessible file.
  • A data gateway is always required for on-prem SQL Server, regardless of whether conditional logic is used.
  • To completely avoid issues, try to maintain consistency across every environment with respect to data sources to avoid failures in the higher environments as well.

Could you please let us know if you have any additional questions?

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thank you!!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.