Shahabaz
Shahabaz

Reputation: 665

Power BI Data point Missing in JavaScript Embedding on CommandTriggered Event

I have Embedded Power BI Report published online on my website(localhost). The main aim is to extract data from the report with some action. For instance there is an option to add new menus to the reports which can provide this action feature.

Sample Menu

I have used a dynamic configuration which sets configuration for powerBI report object.

        report.on("commandTriggered", function(command) {     
            console.log(command.detail.datapoints)
        });

The datapoints seem to be empty in this situation for any clicked chart. How do i get the datapoints or I need the datapoints for the specific chart when custom command is performed.

Upvotes: 0

Views: 535

Answers (1)

RBreuer
RBreuer

Reputation: 1391

Context menu extensions do not return data points, as there is no data point selected.

if you were to right-click on a data point and click your extension in the menu that'd pop out - you'd get it.

There is a coming feature that'll enable you to get the data from all the visual, coming soon..

Update

Export data from visual has just come out :) https://github.com/Microsoft/PowerBI-JavaScript/wiki/Export-Data

You can easily export a visuals data using:

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

or get the underlying data using models.ExportDataType.Underlying instead of Summarized

Upvotes: 1

Related Questions