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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
zurab4000
Frequent Visitor

Dynamically Change Data Source Using Parameter and Slicer

Hi, 

 

I have Data Source: https://example.com/v1/{city}/api=1.0 .

I created parameter (list_param) "List of Value" with City names.

I changed the source : Source = Json.Document(Web.Contents(Text.Combine({"http://example.com/v1/",list_param,"/api=1.0"}))),

 

The data is generated based on the parameter value, works good.

But I want to use Slicer with values of parameter to select City name on the table. How to achive it ?

 

Thanks

5 REPLIES 5
Adamboer
Responsive Resident
Responsive Resident

To achieve this, you can create a slicer with the values from the "list_param" parameter. Follow these steps:

  1. Go to the "Visualizations" pane in Power BI Desktop.
  2. Click on the "Slicer" visual to add it to your report page.
  3. Select the "list_param" parameter from the "Fields" pane.
  4. The slicer will automatically be populated with the values of the parameter.
  5. Select the values from the slicer to filter the data in the table visual.

This way, you can use the slicer to dynamically filter the data based on the selected city name.

zurab4000
Frequent Visitor

Hi @v-shex-msft 

Is there a way to change the data source from a report view?

 

Regards,

Zurab

Hi @zurab4000 

It is possible to define a paramateric SQL query which can be updated in real-time based on the selected value in a slicer. But it seems that it is limited to the data sources that supports DirectQuery. In this ragard, these two links should be useful:

https://youtu.be/L-wqwzj0-Xo

https://learn.microsoft.com/en-us/shows/mvp-azure/pass-parameter-to-sql-queries-statement-using-powe...

 

However, I am still looking for a way to apply the same scenarion on the WEB (RestAPI) data source. Please let me know if you find any solution.

Best regards, Hossein.

HI @zurab4000,

Query parameter is possible to achieve dynamic change the data source. You only need to parameterize the connection string with query parameters.

Current the slicer and filter not able to directly interact with the backend query tables connection string. I'd like to suggest you submit an idea for these requirements.

Microsoft Power BI ideas
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

Hi @zurab4000,

AFAIK, slicer and query parameter are work on different level, you can’t use the front side slicer to affect the background query parameters.

Notice: the data level of power bi(from parent to child level)

Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.