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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
md
Regular Visitor

Dynamic Links In Tables Based On Subdomain

Hi All,

We are working on a Power BI Embedded implementation within an application. 

We have a table in Power BI where each record on the table should link to a corresponding page within the application.

 

 

We don’t have any problem creating a column with a static string and turning that into a link using concatenation, we have done this in testing and it works just fine:

 

URL = CONCATENATE("http://example.com/Page?pageId=", table[pageId])

 

 However, we have many subdomains that will each be displaying the table and each will need ensure that the link is being created to the page within the correct subdomain.

 

 

So, the issue is in dynamically adding the subdomain to that string such that it will link to the correct instance of the application

 

When the table is displayed on subdomain_ONE of the application, the link should look like:

 

 

http://subdomain_ONE.example.com/Page?pageId=table[pageId]

 

 

When the table is displayed on subdomain_TWO of the application, the link should look like: 

http://subdomain_TWO.example.com/Page?pageId=table[pageId]

 

 

It seems like we are looking for something like this:

URL = CONCATENATE("http://", [subdomain], ".example.com/Page?pageId=", table[pageId])

 

Is it possible for the host page to pass back which subdomain it's in into the iframe? Is there another way to accomplish this? We have N number of subdomains for the application so we are looking for a way to build that string dynamically.

 

We have looked at using JavaScript events to create links, but would prefer to have the link generation happen within Power BI, so any modifications to the reports can be done by our BI developers and not our web developers.

 

Note that at this time the data source doesn’t know which subdomain of the application it will be displayed in.

 

Any guidance or ideas would be appreciated!

1 ACCEPTED SOLUTION

Our solution was to have the application write the subdomain to a table on the data source.

So our links are created by looking up that subdomain on the data source and building the URL for the link from there.

 

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee


@md wrote:

Hi All,

We are working on a Power BI Embedded implementation within an application. 

We have a table in Power BI where each record on the table should link to a corresponding page within the application.

 

 

We don’t have any problem creating a column with a static string and turning that into a link using concatenation, we have done this in testing and it works just fine:

 

URL = CONCATENATE("http://example.com/Page?pageId=", table[pageId])

 

 However, we have many subdomains that will each be displaying the table and each will need ensure that the link is being created to the page within the correct subdomain.

 

 

So, the issue is in dynamically adding the subdomain to that string such that it will link to the correct instance of the application

 

When the table is displayed on subdomain_ONE of the application, the link should look like:

 

 

http://subdomain_ONE.example.com/Page?pageId=table[pageId]

 

 

When the table is displayed on subdomain_TWO of the application, the link should look like: 

http://subdomain_TWO.example.com/Page?pageId=table[pageId]

 

 

It seems like we are looking for something like this:

URL = CONCATENATE("http://", [subdomain], ".example.com/Page?pageId=", table[pageId])

 

Is it possible for the host page to pass back which subdomain it's in into the iframe? Is there another way to accomplish this? We have N number of subdomains for the application so we are looking for a way to build that string dynamically.

 

We have looked at using JavaScript events to create links, but would prefer to have the link generation happen within Power BI, so any modifications to the reports can be done by our BI developers and not our web developers.

 

Note that at this time the data source doesn’t know which subdomain of the application it will be displayed in.

 

Any guidance or ideas would be appreciated!


@md

I don't think Power BI could detect the "sub domains". Just imagine that the reports would be finnaly published to cloud, the "sub domains" in an intranet don't make sense. As a workaround, I think you may have to generate duplicated links for each "sub domains" in power bi report. When embedding, in your own application, ask the web developers to get the "sub domains" in the web app and apply filter to embedded reports. This is a one-time work and no more work is required for the web developers. See a demo applying filter.

// Read embed application token from Model
    var embededToken = "H4s xxxx xxx";

    // Read embed URL from Model
    var embedUrl = "https://msit.powerbi.com/reportEmbed?reportId=9da7ec4b-a5dd-4aaa-8056-9684a8084334&groupId=dc581184-a209-463b-8446-5432f16b6c15";

    // Read report Id from Model
    var embedReportId = "9da7ec4b-a5dd-4aaa-8056-9684a8084334";

    // Get models. models contains enums that can be used.
    var models = window['powerbi-client'].models;
 
 
 //get the domains values in your web app
 var domains =["domain1"]
 var  domainFilter = {
        $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "yourTable", //table and column are case sensitive
    column: "DomainName"
  },
  operator: "In",
  values: domains
}
    var config = {
        type: 'report',
        tokenType: models.TokenType.Embed,
        accessToken: accessToken,
        embedUrl: embedUrl,
        id: embedReportId,
        permissions: models.Permissions.All,
		filters:[domainFilter],
        settings: {
            filterPaneEnabled: true,
            navContentPaneEnabled: true
        }
    };

    // Get a reference to the embedded report HTML element
    var reportContainer = $('#reportContainer')[0];

    // Embed the report and display it within the div container.
    var report = powerbi.embed(reportContainer, config);

Our solution was to have the application write the subdomain to a table on the data source.

So our links are created by looking up that subdomain on the data source and building the URL for the link from there.

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.