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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MattPilWork
New Member

Base URL in embedded report

We have a Power BI dashboard embedded in a the angular view provided by MS.  It has hyperlinks that open content in a sub-domain of our website (one per tenant).  I need the base url of that link to be set via configuration or dynamically detected as the url is different per tenant and I don't want to manually republish every 'instance' of my dashboard (currently auto deployed).

 

On the server side we make an embed token setting the report id, datasource id etc.  Most of our reports do NOT use RLS so we don't set the identity.

Reference: https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token 

 

On the client side we set the Report Settings including the embedURL including some custom filter values. 

Reference: https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/configure-report-settings

 

In the dashboard we generate links on rows in a grid that say "Open" and have a hyperlink to https://tenant.domain.com/item/xxx   

 

The same report (pbix) is auto published to multiple tenants and has its data source dynamically changed (this was hard work and tempremental!).

 

The issue is the above url is hard coded to whatever tenant we first saved the PBIX against.  It needs to be either:

  • Dynamic - the published report 'detects' where its being viewed - the current browser url
  • Passed - we can send the base url through some configuration.

 

I'm struggling to find a way to do either....

 

For passing I have looked at RLS effective identity > CustomData  but we don't want RLS and people report this doesn't work anyhow.  I've also looked at the settings object above and can't see any way to pass extra data.

 

Suggestions please. Thanks, Matt

 

1 ACCEPTED SOLUTION

Thanks for the response. Yes we want urls that point to the specific tenants domain.

 

After a restless night I found a solution....

 

In PowerBI we modified our urls to have a placeholder for the base url e.g. www.BASE.URL/api/xxxxx

 

We changed the default hyperlink behaviour to RaiseEvent and not open the urls.

https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/configure-report-settings#hyperlin...

 

We then attached a handler to the dataHyperlinkClicked event:

https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/handle-events#datahyperlinkclicked

 

This handler then replaced "base.url" with the browsers current domain and opens it in a new window.

 

This achieves the required functionality. 

 

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @MattPilWork ,

 

According to your statement, I think your requirement is to link to report dynamicly based on user and tenant.

As far as I know, the pbi report does not contain methods to extract data from external parameters (urlstring, seession, cookie, etc.).

 

Best Regards,
Rico Zhou

 

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

Thanks for the response. Yes we want urls that point to the specific tenants domain.

 

After a restless night I found a solution....

 

In PowerBI we modified our urls to have a placeholder for the base url e.g. www.BASE.URL/api/xxxxx

 

We changed the default hyperlink behaviour to RaiseEvent and not open the urls.

https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/configure-report-settings#hyperlin...

 

We then attached a handler to the dataHyperlinkClicked event:

https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/handle-events#datahyperlinkclicked

 

This handler then replaced "base.url" with the browsers current domain and opens it in a new window.

 

This achieves the required functionality. 

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors