简体   繁体   中英

How to read data point value details from embedded Power BI reports/visuals after embedding in angular or using embedded URL REST API?

In PBI embedding of native app, how to read data from chart/report using embedded url or any other way. For example, how to read integer value inside PBI card . Also how to read values of column, row and legend data of report/chart either in angular or using REST APIs.

Currently we can embed whole report in angular and also PBI REST APIs are available to get dataset id, report id, embed URL. But how can I get data(JSON, XML or any format) instead of embedded URL so that I can customize my own UI design for cards, charts, reports(provided I have data values) when embedding in angular

You can use Export Data API by calling exportData method of the visual, eg like this:

// Exports visual data
visual.exportData(models.ExportDataType.Summarized, 100)
  .then(function (data) {
    Log.log(data);
  })
  .catch(function (errors) {
    Log.log(errors);
  });

Note that there are few limitations, which may prevent you from using this method:

  • Export using Underlying data will not work if the data source is an Analysis Services live connection and the version is older than 2016 and the tables in the model do not have a unique key.

  • Export using Underlying data will not work if the Show items with no data option is enabled for the visualization being exported.

  • When using DirectQuery, the maximum amount of data that can be exported is 16 MB. This may result in exporting less than the maximum number of rows, especially if there are many columns, data that is difficult to compress, and other factors that increase file size and decrease number of rows exported.

  • Power BI only supports export in visuals that use basic aggregates. Export is not available for visuals using model or report measures.

  • Custom visuals, and R visuals, are not currently supported.

  • Power BI admins have the ability to disable the export of data.

  • Concurrent export data requests from the same session are not supported. Multiple requests should be run synchronously.

I don't know what is your use case exactly, but you can get (part of) the visual data too, if you handle dataSelected event (see dataPoints parameter). There is a demo here which used to work, but it looks broken at this moment. Anyway, it may work again.

My personal opinion is that data exports should be performed not from the report, but by connecting to the datasource directly. You can use Get Datasources In Group API to find out the datasource (if you don't know it - it's your report after all) and get the data from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM