Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to dynamically get data from the table based on query string parameters in the Power BI URL

Requirement:

I have a requirement which should let the user to analyze data from Power BI dataset hosted on Power BI Services based on the table name passed as query string parameter in the report URL.

Current solution in progress:

I have 2 datasets:

  1.  DataTable: This is the actual table that user wants in Power BI Services to perform analysis and it needs to load the data dynamically based on user's table selection. Dataset  looks like "select * from tablename", where tablename is the query string parameter passed by the user in report URL.
  2. ListTables: This has a single column containing the list of tables and the value from this dataset will be used by the user as query parameter in report URL to pass the tablename.

URL looks like; ReportURL?filter=ListTables/Names eq 'Table Name' . I thought M query modified as shown below would work.

User will open the report url with parameters, click on edit , it would load the required table (direct query) and be ready for  analysis.

SnehaJo_0-1603989194174.png

Problem is that the query parameter URL only filters the "ListTables" but won't pass the filtered value from "ListTables" to the "DataTable"  for it to run the select statement.
I assumed since "ListTables" gets filtered with single value (table name passed by user), this would be the only and first value in that table and it will work as expected with M query's Table.FirstValue function. 

But Power BI Services loads both the tables at once and then filters the data. This solution is not working.

I hope I was able to describe my usecase. Any help would be greatly appreciated.

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can use Query Parameters to get the data from different tables by dynamic, please find the details in the following links.

Dynamic Power BI reports using Parameters

Power BI Desktop Query Parameters

How to Use & Update Parameters in the Power BI Service

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors