Power BI Embedded - Programmatically determine sort setting for a visual

Viewed 87

We have an embedded Power BI solution (embed for customers/app owns data)

Is it possible using any Power BI APIs to, given an embedded report with a visual, to determine the sort settings for the visual.

For example, the user creates a table with one column, 'column1', say. They sort column1 descending.

We would like to, using JavaScript, analyse the visual and know that column1 is sorted in descending order.

I don't think this is currently available in the API but wanted to see if I had missed something. (I know about visual.orderBy() to SET the sort settings, we need to GET the sort settings)

Is this possible?

Thanks

1 Answers

You can not determine the sort settings applied to the visual, that feature is not available currently.

For Example:
a. Before applying the sorting:

console.log(visual);

b. After applying the sorting:

await visual.sortBy(sortByRequest);
console.log(visual);

Output Before :

Output After :

Please find the reference: https://docs.microsoft.com/javascript/api/overview/powerbi/sort-visuals-by

Related