Felipe Carminati
Felipe Carminati

Reputation: 317

How to get the Table name and report section from a PowerBI public report?

I'm looking to build a search feature across multiple public PowerBI published reports. I want to be able to filter, for example, a company name and return all reports that have that company mentioned.

I'm testing the 'Page and Filter on URL' feature. The problem is: I don't know how to find the Table name or the Report Section from a published report. Is that info public?

For this panel, for example: https://app.powerbi.com/view?r=eyJrIjoiNGI1OGYwOTgtZWQ5YS00Y2I4LTlkOTUtNjI4MDE1Yjk4MjE1IiwidCI6IjQwZDZmOWI4LWVjYTctNDZhMi05MmQ0LWVhNGU5YzAxNzBlMSIsImMiOjR9

I want to be able to navigate to the first page report view (Relatorio de projetos por tipologia...) and filter for 'Eletropaulo', but I would require the Report Section ID and Table name, which I don't know how to find (of even if I'm able to). The query URL would be something like this:

https://app.powerbi.com/view?r=eyJrIjoiNGI1OGYwOTgtZWQ5YS00Y2I4LTlkOTUtNjI4MDE1Yjk4MjE1IiwidCI6IjQwZDZmOWI4LWVjYTctNDZhMi05MmQ0LWVhNGU5YzAxNzBlMSIsImMiOjR9&pageName=**ReportSectionID**&filter=**TableName**/Sigla='Eletropaulo'

I'd love if someone could tell me if I'm able to gather these parameters, and if Yes, how to do it. Thanks!

Upvotes: 3

Views: 2334

Answers (1)

Amira Bedhiafi
Amira Bedhiafi

Reputation: 1

Let me explain to you the situation here: the information about the Report Section ID and Table name is not publicly accessible from the published Power BI reports. These details are not exposed through the Power BI service or the report URL.

Regarding the 'Page and Filter on URL' feature in Power BI allows you to specify the report page and apply filters using query parameters in the URL, but it requires you to know the names of the report pages and the fields within the tables.

You can use the Power BI REST API to programmatically interact with the reports and retrieve the necessary information

. Using the API, you will be able to access the report metadata, including the report sections, tables, and fields.

Begin with registering an application in Azure Active Directory to obtain the necessary credentials for accessing the Power BI API : client ID and client secret for API authentication.

Then authenticate with the Power BI REST API: try to obtain an access token by making a POST request to the Azure AD token endpoint using your client ID, client secret, and other required parameters.

Make a GET request to the Power BI REST API's Get Reports endpoint (https://api.powerbi.com/v1.0/myorg/reports) using the obtained access token. You need to parse the response to extract the necessary information such as the report IDs and names.

For each report, make a GET request to the Get Report In Group endpoint (https://api.powerbi.com/v1.0/myorg/groups/{group_id}/reports/{report_id}) to retrieve the report metadata. You need to extract the report sections, tables, and their corresponding fields from the response.

Now you have everything to implement the search functionality:

  • Iterate through the retrieved reports, sections, and tables.
  • For each table, construct a DAX query that includes the desired filter condition (e.g., CompanyName = 'Eletropaulo').
  • Execute the DAX query using the Execute DAX Query endpoint (https://api.powerbi.com/v1.0/myorg/groups/{group_id}/reports/{report_id}/models/{model_id}/queries) and pass the DAX query as the request body.
  • Parse the response to retrieve the filtered data.

Check the documentation if you need to know more about Power BI REST API: https://docs.microsoft.com/en-us/rest/api/power-bi/

Upvotes: 1

Related Questions