Forum Discussion
SeshadriP
1 year agoNew Member
Dynamic Parameters Creation in PowerBI Using Stored Procedure
Hello, Can someone guide me, How can we create a dynamic parameters in PowerBi through Direct Query mode with Date parameter and date parameter should be in datetime format When we are trying...
andrewsommer
1 year agoSuper User
I assume you have already nabled dynamic M query parameters?
- Create a Parameter in Power BI
- Go to Modeling > New Parameter > Fields.
- Choose DateTime as the type.
- Provide a range (start, end, or list of dates if needed).
- This parameter will be used in an M Query.
- Modify the M Query in Power Query Editor
- Open Power Query Editor.
- Select the table connected via DirectQuery.
- Click Advanced Editor and modify the query like this:
let
Source = Sql.Database("YourServer", "YourDatabase"),
FilteredData = Table.SelectRows(Source, each [DateColumn] >= DateTime.From(#"YourParameter"))
in
FilteredData
- Bind the Parameter to a Report Slicer
- To make the parameter interactive:
- Create a new table with a column containing datetime values.
- Create a slicer using that table.
- Bind the slicer to the parameter using Field Parameters.
Please mark this post as solution if it helps you. Appreciate Kudos.