Forum Discussion

nvalPBI's avatar
nvalPBI
Regular Visitor
1 year ago
Solved

Can end users Input parameters in a Power App form and pass it to a Power BI query ?

I am working on a report where I need to pass a date field  to sql query to pull data for the POwer BI report.  Currently date is hard coded and I would like  to change it to a variable which accepts...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hey nvalPBI ,

    You’ve done all the hard work already great job.

    Now to plug that SharePoint date into your SQL query, here’s exactly what you need to do.

    1. Load your SharePoint list into Power BI
      → Make sure it includes the Term Date the user entered.
    2. Keep just the latest Term Date
      → In Power Query, sort by Created Date (or ID), keep the top 1 row.
    3. Create a parameter in Power BI
      • Go to: Manage Parameters → New Parameter
      • Name: TermDateParam
      • Type: Date
      • Set a dummy default value for now (we’ll override it)
    4. Use that parameter in your SQL query
      • In Power Query, edit your SQL like this.
    let
    TermDate = TermDateParam,
    Source = Sql.Database("YourServer", "YourDB",
    [Query = "SELECT * FROM YourTable WHERE TermDate = '" & Date.ToText(TermDate, "yyyy-MM-dd") & "'"])
    in
    Source

         5. Link the SharePoint date to the parameter

      • In Power Query, get the latest Term Date from the SharePoint table
      • Use it to replace the parameter’s value

    Regards,
    Akhil.