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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
apenaranda
Post Patron
Post Patron

Add another or more pbix but connected to data source uploaded to power bi

Hello,

 

From what I understand, the App-Owns-Data Starter Kit has a pbix template that uses the report to display in the different scopes that are created. My question is how can I change that pbix? Can I put several since in my case I have more than one report?

As it seems, take the following code to do it:

 

 

 

public PowerBiTenant OnboardNewTenant(PowerBiTenant tenant) {

 

      PowerBIClient pbiClient = this.GetPowerBiClient();

 

      // create new app workspace

      GroupCreationRequest request = new GroupCreationRequest(tenant.Name);

      Group workspace = pbiClient.Groups.CreateGroup(request);

 

      tenant.WorkspaceId = workspace.Id.ToString();

      tenant.WorkspaceUrl = "https://app.powerbi.com/groups/" + workspace.Id.ToString() + "/";

 

      // add user as new workspace admin to make demoing easier

      string adminUser = Configuration["DemoSettings:AdminUser"];

      if (!string.IsNullOrEmpty(adminUser)) {

        pbiClient.Groups.AddGroupUser(workspace.Id, new GroupUser {

          EmailAddress = adminUser,

          GroupUserAccessRight = "Admin"

        });

      }

 

      // upload sample PBIX file #1

      string pbixPath = this.Env.WebRootPath + @"/PBIX/SalesReportTemplate.pbix";

      string importName = "Sales";

      PublishPBIX(pbiClient, workspace.Id, pbixPath, importName);

 

      Dataset dataset = GetDataset(pbiClient, workspace.Id, importName);

 

      UpdateMashupParametersRequest req =

        new UpdateMashupParametersRequest(new List<UpdateMashupParameterDetails>() {

          new UpdateMashupParameterDetails { Name = "DatabaseServer", NewValue = tenant.DatabaseServer },

          new UpdateMashupParameterDetails { Name = "DatabaseName", NewValue = tenant.DatabaseName }

      });

 

      pbiClient.Datasets.UpdateParametersInGroup(workspace.Id, dataset.Id, req);

 

      PatchSqlDatasourceCredentials(pbiClient, workspace.Id, dataset.Id, tenant.DatabaseUserName, tenant.DatabaseUserPassword);

 

      pbiClient.Datasets.RefreshDatasetInGroup(workspace.Id, dataset.Id);

 

      return tenant;

    }

 

 

The issue is that in my pbix I access the data through a data source that I have in powerbi, if I simply change the pbix it gives an error because it tries to connect to a database that does not exist.

Do you know how I can proceed to change a pbix/add more to this code?

Thanks.

3 REPLIES 3
apenaranda
Post Patron
Post Patron

Is there no one who can help me?
I want to use another pbix but it doesn't connect to any sql database, it's just a pbix connected to a data set from another pbix and with more than one report.

Hi @apenaranda ,

 

According to your description, if you are connecting datasets in the service, you cannot merge pbix. The connection mode is Live connection.

 

Reports that share a dataset on the Power BI service don't support automated deployments using the Power BI REST API.

 

https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-report-lifecycle-datasets#considerati... 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

So the only way I have is to use a pbix with the data?
I mean, not the one that comes as an example but another one of mine and with more than one report inside.
The thing is that when you create the tenant, you create it with all the reports there are... I don't know if it would be possible.
Thank you very much.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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