How can I use a parameter in a MS Power Bi web data source string? - powerbi

I have a URL that returns a json object with everything I need for my power bi embedded report. I get the data for the report by adding a new web data source and pasting the URL in. a few transformations later and tada! sexy report. the report shows lots of charts and graphs etc... however I need to be able to change the datasource URL depending on who is looking at it.
The report shows data for a single organization. You can only look at it if you're in that organization. how can I pass an organizations ID when embedding the report so that the datasource will show different data?
for example if my datasource is defined in the originating pbix as
Json.Document(Web.Contents("http://www.testdata.com/api/json?orgId=1"))
how can I change it to
Json.Document(Web.Contents("http://www.testdata.com/api/json?orgId=2"))
when I'm pull the report to embed on a page?
I know you can filter data but that means I have to make the datasource URL pull ALL the data which would be huge and intensive just to have bi filter out something.
In short, I'm embedding a report on a website and tat report's only way to get data is via a json endpoint. That endpoint requires the org id of the user so how do I pass it to bi which in turn uses it in the data source url?

Your only option for this scenario is to pull all the required data into your dataset. Then you can use either Role Level Security (RLS) or the new JS API to filter the data for each user.
You should probably look at an Azure SQL data source as a more efficient, flexible and scalable back-end for PBI Embedded.

Related

Adding static Excel to automatically refreshing Power BI report

I have an existing PowerBI report that imports data from an SQL Server analytics services database. This is working fine and I can schedule automatic refreshes using the Gateway provided by my organization.
I would now like to add some additional, but rarely changing data, that I only have in a local Excel file. When I do add this data, the report stops refreshing automatically and complains, that it has no gateway to refresh this Excel file.
What I would like is that Power BI is refreshing the data of the SQL Server analytics services database, but just keeps the existing Excel file without updating it. - I will upload an updated version of the PowerBI report if I need to change the data in the Excel file.
Is that possible? I couldn't find out how. I was trying to upload the Excel file to a different dataset to the Power BI service and reference this dataset in my report. Just to find out, that I cannot access a different Power BI dataset and SQL server analysis services database from the same report.
Three things I can think of
Upload the file to onedrive/sharepoint so that it's accessible online (per Dev's answer)
If the data is simple enough, you can add the data directly into PowerBI itself and skip the Excel file entirely.
You can disable the Excel file refresh so that PBI does not try and refresh(and thus access) the local Excel file. (Not sure if this will work)
I had a similar issue I came across. Yes, you can just use Enter Data to add a table, but you can only build something with less than 3000 cells, so you'd have to merge several tables if something was larger than that.
Turning off the report refresh in the suggestion above (#3) still requires a gateway, unfortunately.
I just created a dataflow and plopped the data from my csv there. You'll have to create a connection and refresh it, but you don't need to schedule a refresh there, so no need to create a gateway.
Then just link the dataflow as a source to your .pbix file and setup your gateway to point at the dataflow.

PowerBI report service - data flow questions

This is what I am trying to do: I have various SQL server databases with data. I created views in all of them. All views will need to be imported, and I specify their relationships. I want this to be refreshed nightly. I want to build various reports of the same data source.
Do I have to use a PowerBI desktop application to import data into PowerBI Report Service? [I have done this so far, but then can create new reports in the cloud on existing data. It would make sense to connect directly from PowerBI report service to my SQL servers.]
Once I uploaded data using a desktop application (as I have done so far), how can I view the data model in the report service once it is uploaded in the cloud?
In order to get routinely refreshed data I need to setup a gateway. Is the local PowerBI desktop application still involved in this process, or could I [in theory] delete the local desktop application that pushed the data in initially?
For your questions:
You have two options, use PBI Desktop to connect to the data using import/direct query, then load it to the service. You can use dataflows to create an import based on your views, but you will then need to create reports from those. Using dataflows, you'll have to set up a refresh schedule, then for the dataset(s) built on top of those, you'll have to set another refresh schedule.
You will be limited to the dataset sizes of 1GB for the workspace if importing data. You cannot use direct query on dataflows (unless you have enhanced compute with PBI premium). Once the dataset is loaded, you can then create new reports in the service or via desktop on top of that dataset. If possible it is recommended to use direct query.
To see the data model, you can use desktop to connect to PBI Service Dataset. This will connect in 'Live Connection' mode, and will be limited to that one dataset, you can't add others to it, Excel, CSV, SQL etc. You can also use Analyse in Excel, a plugin for Excel, that can connect to the data model. You can create new reports in the service for existing data models as well.
When creating the report in PBI Desktop it does not use the Gateway, you connect to your data sources as normal, then once you load the dataset to Power BI it will match the data sources in the file to the ones set up in the Gateway Admin settings. So you will still need PBI Desktop to create reports, but the gateway is there for the refreshing. The Desktop is not used in the process for refreshing. You could delete the workbook or application, but if you have to make changes, what will you refer to? (You could download a copy of the report from the service).+ It is easier to make changes in the desktop app, then the service, as there is a feature difference between dataset creation in the desktop vs service.

PowerBI Dataset and Report replacement

So, I created dataset that can be used to generate multiple reports and dashboards.
I would like to publish to the web portal and allow report designers to create their own reports and dashboards. Which works great until I need to update the model. If I update the model and push the data set via Publish function it deletes the reports.
So is the only option for everyone to use PowerBI Desktop? What is the web-based report designer for? Is this only for datasets that will never change?
If your Power BI file has reports in it, it will over write them. What I think is happening is that your users are updating the report in your dataset, for example adding a new tab, so when you load changes it overwrites them.
You need to decouple the Dataset from the reports. You can load your dataset with out any reports. You can then build reports using two methods.
1) Connect to the dataset using Power BI Desktop, using the connect to Power BI Dataset connection. That links to the dataset in a Live Connection, so you can build your reports from that. You can then publish your report. Any changes to the dataset will not overwrite it.
2) For the Web builder you can do the same, create a new report in the portal and select a dataset from that workspace to build your report. What the user needs to do then is 'Save as' and give that report as a new name.
Both methods just link to your dataset, not build a report directly in the file

Portability of Power Bi reports containing power bi datasets

I'm using Power bi service along with power bi desktop version.
What I'd like is to spend less time on setting up UI for my charts.
Let's say I have multiple accounts with power bi datasets in them (hybrid dataset to be able to display data in real-time).
Currently I have to create report on each of them, set up charts etc. I expected to create pbix file once and then just publish it to different accounts. But when it comes to reports bound with power bi datasets, it is no longer possible. Even if account already has exactly the same hybrid dataset.
Any ideas on how to implement portable reports?
If I got your point correctly, you have multiple accounts and in each of them you have the same dataset. You want to create open report, which you will publish to all of these accounts. I do not understand why do you need to create a new report for each of your accounts. Why not just change the data source of your report prior publishing it to each of these accounts?
Also it is not clear, how these datasets are created. I think there are two possible options here - these datasets are published with your report, or they are existing datasets not published with this report.
In the first case, just design your report, getting data from your database, and publish the report in each of your accounts. You could change the data source prior every publishing, if your different accounts/datasets should get data from different databases.
In the second case, when you design your report, do not get data from the database, but connect the report to the Power BI Service itself:
and pick the existing dataset:
Before each publish change the account you are logged in, change the data source of the report and select the dataset from the corresponding account. This way when publishing the report, the dataset will not be overwritten, but will be shared between this report and any other report who uses it.
To change the data source of your report, in the drop down of "Edit Queries" button, select "Data source settings" and then click "Change Source..." button.
In both ways you will design your report only once, but it will be published in different accounts using different data.
Are all of your users in the same tennant/company?
If so, create a workspace. Create your report which uses another power BI dataset as its source. Turn on row level permissions. Share the new report to all people. They will only see the data relevant to them and you will only need to maintain one report.
Row level security in power bi
I have used Power BI Service with Multiple Reports/Users in Same Organization with Shared Data Sources using different Reports for each user using the same Datasets.
From your Admin Account (eg. it#contoso.org) Publish all the Reports and once its working from Online (after configuring Gateway and DataSources). Download the PBIX Report File from Power BI Online.
Using Admin Account go to Dataset Settings and Allow the users who will use reports using this datasets to Publish Reports using this Dataset (further security to use dataset i.e. Even if they get the source PBIX File and upload it they wont get access to the data).
Login using the Users Power BI Account (must be within Same Organization, eg. contoso.org) then upload the Same PBIX Report File which was downloaded Earlier from Power BI Web Portal (do not publish via the Desktop App), its more efficient and cleaner on Accessing the Data through Web/Devices.
Now the reports as already they are using the same shared Datasets, the reports will be running fine and the data source settings only have to be done once from Admin User.
And for any further databases Administration only One Admin Account need to be used to access and modify the Data Source Settings.

How to access single tenant Azure Analsysis Server with Power BI Embedded

So, currently I'm having difficulty understanding how Power BI Embedded can be setup so that each customer can access data from their own separate Azure Analysis Service, this is an App Owns Data situation. Analysis Services will be running in In-Memory mode and it will be accessed from Power BI via Live Connect.
Ideally I would like the Power BI Report to be ignorant of the data set/data source until the embedded report is provided with a parameter (e.g. connection string) which the report interprets so that it knows which server to connect to. So, ideally have: one Workspace, one Report, and zero (or a fake) Dataset.
The following is roughly what I'm looking to do (note the Red and Blue flow access a different server):
It looks like if I created both a Report and Dataset per customer I can achieve my goal but this seems like a poor approach since if the Report needs to be updated this involves updating, potentially, hundreds of reports. Also creating hundreds of Reports seems like unnecessary overhead when all Power BI needs to change for each request is the connection string pointing to the data source.
So is it possible to share the Workspace and Report across all customers but having completely separate data sources? Or is my approach in conflict with the way Power BI expects to function?
To date, I've tried using Query Parameters when configuring the data source in Power BI Desktop but I get the following error:
The connect live option for this file is disabled because it already contains data from another data source. You cannot explore live data and connect to another type of data source in the same file.
Please note,
Every report in Power BI can be connected to only one Dataset.
There is NO ability to dynamically change a connection string on the fly.
Currently, and in the foreseeable future, you'd have to clone the report & dataset per customer (or per connection setup) and modify the new dataset's connection string to match.
You can then dynamically choose which report to display based on your customer's needs.
Cloning a report can be done using:
POST https://api.powerbi.com/v1.0/myorg/reports/{report_id}/Clone
POST https://api.powerbi.com/v1.0/myorg/groups/{group_id}/reports/{report_id}/Clone
https://msdn.microsoft.com/en-us/library/mt784674.aspx
Changing the connection string would be done using:
POST https://api.powerbi.com/v1.0/myorg/datasets/{dataset_id}/Default.SetAllConnections
(similar API for groups)
https://msdn.microsoft.com/en-us/library/mt748181.aspx
using the C#.NET library provided by Power BI team, you'd use
Reports.CloneReport(string reportKey, CloneReportRequest requestParameters)
Datasets.SetAllDatasetConnections(string datasetKey, ConnectionDetails parameters)