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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. 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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.