Forum Discussion

Sudip_KJ's avatar
Sudip_KJ
Regular Visitor
1 year ago
Solved

Want to connect Power BI with API with using Parameter to filter the Dataset

Hi Teams, I want to connect the Power BI with API having datasets of Marketing campaign and sales report having Parameter filter with challenges to get filter the data directly into the inteface- C...
  • DataVitalizer's avatar
    1 year ago

    Hi Sudip_KJ 

    To connect Power BI to APIs with filters, here’s a clear step-by-step guide to get you rolling:

    1. Create new parameters (CustomerName = "Sean Abort" and Region = "Central")
    2. Dynamically insert the parameters in the API using Power Query:
    let
    Source = Json.Document(Web.Contents("https://api.example.com/data", [
    Query = [
    customer = CustomerName,
    region = Region
    ]
    ]))
    in
    Source

     

    Other methods:

    • Use Power Automate to automate API calls and push data to Power BI via streaming datasets.
    • Preprocess API data and send it to Power BI using Azure Functions or Logic Apps

     

    Did it work? 👍 A kudos would be appreciated
    🟨 Mark it as a solution to help spread knowledge 💡

     

    🟩 Follow me on LinkedIn

  • v-kpoloju-msft's avatar
    1 year ago

    Hi Sudip_KJ, 

    Thanks for reaching out. Also, thanks to DataVitalizer, for his inputs on this thread.  I understand you are looking to connect Power BI to an API and filter the data by parameters like Customer Name (Sean Abort) and Region (Central) and wondering if there are better ways to do this beyond just pasting the API URL into the Web connector.

    You are on the right track using the Web connector. To filter the data directly using parameters, one effective approach is to create Power Query parameters in Power BI. These let you dynamically build your API URL so you can pass values like customer name or region directly into the request.

    Here is a helpful guide from Microsoft that walks through how to do that:

    Web.Contents - PowerQuery M | Microsoft Learn
    Parameters - Power Query | Microsoft Learn

     

    Other API connection options: If you are wondering whether there are other ways to connect to APIs yes. Besides the Web connector, Power BI also supports:

    • Using Power Query functions to loop through multiple parameter values
    • Creating custom connectors, which are useful especially for APIs that require authentication (e.g., Facebook, Instagram)

    Connecting to social media platforms (like Facebook or Instagram): These APIs often require OAuth (authentication via access tokens), so connecting them directly in Power BI usually involves a more advanced setup either through a custom connector or an external service like Azure Functions. You can explore that route here:
    Connector extensibility in Power BI - Power BI | Microsoft Learn

    Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

    Thank you for using the Microsoft Fabric Community Forum.