Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I created a dataset in my Power BI workspace programmatically using the REST API - just defining a few simple tables, and then added some data to it, again, using the REST API. This is all based on https://powerbi.microsoft.com/en-us/guided-learning/powerbi-developer-walkthrough-push-data-add-rows... and works fine.
I then used Power BI (Desktop) to create a .PBIX that points to this dataset and built reports around this data. I then uploaded the PBIX to my Power BI workspace, again, using the REST API, and verified that I can continue adding data to it after that.
Here's my problem: Assume I want to give my PBIX file to another user and give him a program that'll upload the PBIX to his workspace so he can see reports for his own data. The dataset doesn't exist under his account, so the upload fails. So I tried to modify my app to predefine the empty dataset, just like I did from my own account on my own system, and then upload the PBIX - however, that also fails. The Dataset ID (a GUID) that was just created is obviously different than the Dataset ID that's defined in my PBIX, so it's still just as if it didn't exist at all.
The whole reason I have a PBIX file I want to upload is that it contains report definitions, which I can't recreate programmatically.
I'm obviously missing something to accomplish what should be relatively straightforward: My users aren't sharing the same data; in fact they're in completely separate organizations. *I* don't have access to their data or accounts. However, they do have some data that my app can read - I want my app to read this data, upload it into a dataset, and upload a report (the whole reason I have a PBIX at all), and have my app continue uploading data to this dataset on a regular basis. All users are in different organizations and work independently. What are my options? Really, the only part I'm missing is getting a report created, that is using a dataset that was created programmatically.
Does this make sense? I hope this is somewhat coherent.
Old thread i know, tho we just found a solution to this problem...
1. Create your .pbix file with data that is "Imported", this whole thing wont work if you use a Live Connection
2. Ensure that the .pbix imported dataset has matching table and column names (case sensitive) to the target dataset in PowerBI Online
3. Upload the .pbix via the API (/imports)
4. Rebind the report to the new (target) dataset using the /reports/<id>/Rebind api call
5. (optional) Delete the dataset that was auto generated during your .pbix upload (/imports api call)
If the data that needs "Importing" for your .pbix is an PowerBI Online Dataset we had success duplicating the data model from the Dataset in excel, importing that into our .pbix, then uploading into PowerBI Online
I don't think the REST API pushing data is supposed to work the way you expected for the external users(the ones not in your orginazation). The better approach in your case would be using the being depredicated Power BI Embeded and its Role Level Security feature. Actually I'd suggest you use the new Embedding with non-Power BI users (app owns data) to avoid any migration work from Power BI Embedded after it completely decommissions, it is the replacement for Power BI Embedded, however its RLS feature(may come soon) is not yet available.
So in my opinon, as you have access to read your customers data, you can
> as you have access to read your customers data
Actually I probably haven't made this entirely clear. My app, a standard Win32 desktop app that ships with my .PBIX file on disk, has access to my customers' data because they all install it in their own environment - *I* do not have access to that data remotely. I can't see it, I can't access it, I can't customize reports around it. But, the data comes from a common source my app (installed in their environment) can read and understand.
Anyway, I managed to work around the problem I was having as follows. It's a bit of a kludge, but it seems to fill my purposes and seems to work reliably:
I redid my .PBIX file with a dataset set up to point to a local database. This obviously won't work in my customers' environments, but no matter. I designed my reports around this data, and saved everything to disk as a .PBIX.
My Win32 app now uses the REST API to:
- POST my PBIX in whatever account the user used to login
- Get the dataset ID (call it "InitialDS")
- POST a dataset definition as a JSON string, which simply matches the one that now already exists
- Get its dataset ID (call it "NewDS")
- Rebind the report to "NewDS", as per https://msdn.microsoft.com/en-us/library/mt784672.aspx
- Delete "InitialDS"
At this stage, I have one dataset, one report, and from that point forward my app can POST new rows to that dataset at it pleases.
I'd love to hear some thoughts. Am I doing something insane that might break in the future?
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |