PowerBI publish to web add parameter - powerbi

I have a Power BI report that I want to integrate with my outward facing website.
On my website, if the user clicks on the name "Frank" I would like to pass this paramter to my BI Report. Internally this works with
Query00/name eq 'Frank' appended to the report's URL.
However, when I publish this report to the WEB (Public not within the organization) this parameter string does not work. How do I pass a parameter to a published BI report?

As you can see from the official documentation, this isn't supported:
Query string filtering doesn't work with Publish to web or Export to PDF.
You can either add slicers to your report, which will allow your visitors to filter the data, or embed it in another way.
Secure embedding supports URL filters, but the proper way to do this is to actually embed the report into your site. You can see it in action in Power BI Embedded Playground. When embedding, there are two scenarios - "user owns data", in which each visitor needs Power BI Pro account to see the report, and "app owns data", in which your application uses one Power BI Pro account to authenticate itself, but your users don't need to have Power BI accounts at all. In your case you need the later one.
Simply download Microsoft's sample application and configure it. You need to register Azure AD application to be used in your app. Then your app will authenticate itself and use Power BI REST API to get report's embedUrl and use it with Power BI JavaScript client to embed it in an empty <div> in a web page.
How to embed Power BI is a common question here on StackOverflow, so you can also read other answers, like:
Is there any way to embed power bi reports and dashboards in vb.net or C# desktop application with sql server 2008 database?
How to set filters in reports power BI embedded javascript
How to integrate Power BI in a Delphi desktop application

INTEGRATION OF POWER BI WITH HTML PAGE AND ESTABLISHING COMMUNICATION BTW HTML PAGE AND POWER BI
In this example we will embed the powerbi content in html page and create button in html page through which the view of the page will change. the below example i have modified as per above question
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<button class="textLarge" onclick='show("ReportSection", "Frank");' style="display: inline-block;">Frank</button>
So here I am using a button click function "show" which has two parameters one is "page name" and other is "filtervalue"
and I have a iframe through which I am embedding my power bi report.
just remember that the filter value and you are putting is similar to the one in the published Bi report. Avoid spelling mistake as there would be character matching on the string.
<iframe id="embeddedframe" width="2000" height="1000" src="https://app.powerbi.com/reportEmbed?reportId=(put_your_report_id_here_and remove_parenthesis)&groupId=(put_your_group_id_here_and remove_parenthesis)&autoAuth=true&ctid=(put_your_ct_id_here_and remove_parenthesis)&pageName=" frameborder="0" allowFullScreen="true"></iframe>
Basically you don't have to edit the iframe URL, you can directly get it from bi service portal
Then call the below function
In below function you need to edit the
1) baseURL
2) Table_Nameand Colum_Name
3)iframe_id
<script>
function show(pageName, filterValue)
{
var baseUrl='https://app.powerbi.com/reportEmbed?
reportId=b0f&groupId=e2c&autoAuth=true&ctid=efc8&config=e&pageName='
var newUrl = baseUrl + "&pageName=" + pageName;
if(null != filterValue && "" != filterValue)
{
newUrl += "&$filter=Table_Name/Column_name eq '" + filterValue + "'";
}
//Assumes there's an iFrame on the page with id="iFrame"
var report = document.getElementById("embeddedframe")
report.src = newUrl;
}
</script>

Related

Page with Filter selected Export from Power BI to Power Point or PNG

Has anyone tried a multi page filter and export each page on the Power BI Report to PNG or Power Point?
Example:
First page is a filter of Users Account. If I choose my account, it will reflect the filter on all other pages.
Now the output that we are trying to make is a automation with a button that will export all the pages of each Power bi pages with all the filters that user selected from the App.
These are the workarounds that me and my team are working at. We use Power Automate in Power BI and create button that will trigger a Power Automate Flow. The current issue is we cannot call multiple bookmarks and page in the same row function. That is the reason why I tried to fetch the pages and bookmark per function. Also, the filters in app from power bi from the users will not affect the PNG's and will only export the default pages from the report
Another work around is setting up a Power Point with all the pages ready with the add ins live and link of each pages from Power BI Service. With these way, we are able to create a export function and the Row Level Security will still handle the security. However, this has the same issue of not reflecting the user's selection from the multi sync filter per page.

Power BI Admin Portal : Publish to Web Embed Code

In Power BI admin portal, we are able to see all the embed codes, & view them on web also. Is there any possible method to export "View On Web" option for all the embed codes when we export other information (Report Name, Workspace Name etc), or any alternative to get this information in bulk as I have multiple embed codes.

Ability for users to print or export embedded PowerBI report

I'm really new to PowerBI.
I have a report embedded on a webpage for other non-PowerBI users (clients).
I want to know if there is a way that the clients will be able to either print the report or to send it as an email attachment from the webpage. Can either of these be done?
You can allow your consumers to print the report. This can be easily achieved by using Power BI JavaScript APIs.
First add an HTML button, which will allow the user to click to Print their report.
<button id="theClick" onclick="print()">Print</button>
Once you have your button, then add the javascript for it.
function print() {
var element = $('#report-container')[0];
var report = powerbi.get(element);
report.print();
}
For more information, you can read the official documentation by Microsoft: https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/embedding-basic-interactions.
You can use Power Automate to export your reports via email. The official documentation link is: https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-automate-power-bi-report-export

Webservice to open external program when clicking link in Power BI

as Microsoft Power BI only allows to add hyperlinks of the following types
mailto
News
Telnet
FTP
File
I was thinking, if it could be possible to write a small webservice (ideally under IIS), which redirects an URL to let open a different hyperlink type.
The thing is, that I made a Power BI report, which reads from a Microsoft SQL server instance, which is running behind a propriertary Windows native CRM software.
What I want to achieve is to get back to the software, as soon as e.g. a customer number in the Power BI dashboard is clicked (made clickable using the conditional formatting).
It is already possible to open the dataset using an URL by entering something like:
<applicationname>:OpenAddress?Number=12345 in my Webbrowser.
So as Power BI does not let me add this syntax directly, I thought it could be possible to have a link like http://localhost:8080/OpenAddress?Number=12345 which redirects to the above individual hyperlink type.
Thanks in advance for any ideas.
Regards
Lars
After a while of thinking I solved this issue using some simple lines of Javascript:
let params = new URLSearchParams(location.search);
parameter = params.get('number');
finalurl = "<applicationname>:OpenAddress?number=" + parameter;
window.location.replace(finalurl);

Dynamic parameter insertion to filter data in iframed dashboard from with in webapp

We have a web applicaiton used by over 1000 customers.
We would like the abilitu to assist over customers to analyse their account level information i.e. Spend analysis, account overview, product overview.
What we are looking to find a way of passing a customer ID to a query datasaet that pulls customer specific information from the database and binds it to the published iframed power bi dashboard on the go.
Thanks in advance
I would suggest to design a generic report on Power BI desktop using the Customer ID as a report level filter. Then, when you embed the report in your web app, you can set the filter to each customer's ID by passing it as a parameter on the embed report URL:
https://app.powerbi.com/reportEmbed
?reportId=d2a0ea38-...-9673-ee9655d54a4a&
$filter={tableName/fieldName}%20eq%20'{fieldValue}'
(from Power BI embedded documentation)
If you need more ability to interact with your report I'd recommend the documentation on the JavaScript API for Power BI Embedded.