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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
sqldev2017
Microsoft Employee
Microsoft Employee

Passing Timeline Slicer values to SQL Query as parameters

Hi, 

 

I have created a timeline slicer , with date values coming from a SQL Query.

 

 

Now Depending on the Start and End Date/Times selected on the Timeline slicer , I want to dynamically pass these date values to another query, from which data in a table is generated in the report.

 

Please help.

8 REPLIES 8
vanessafvg
Community Champion
Community Champion

are you working in imported mode or direct query?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




My data connectivity mode is "Import"....

 

I know how to modify the "Power Query M" , to pass a parameter....

 

But how do i pass the Start and end Dates in the Timeline Slicer to the Query ?

so you want to

 

power bi timeline slicer parameter ---> pass to power query ---> pass to sql data source correct?

 

if that is true, i am not sure how that would work as the refresh of an imported model happens before you adjust your slicer or am i misunderstanding your requirement?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




So basically , this is what it is - 

 

I have a data source which has a "SQL Query"..... (I have written a SQL Query, but obviously on saving it converts to Power Query)

 

I want to be able to pass the Start and End Dates from the "Timeline Slicer" as parameters to this "SQL Query"......

 

 

It is the same as what is being asked here - 

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4ed6009e-52dc-4107-81d5-80052121995a/pass-t...

 

 

happy to be wrong but dont think that is possible in imported mode, in direct query that would happen automatically i would think as its only looking at live data.

 

maybe this post can offer more info or a work around

 

https://community.powerbi.com/t5/Desktop/How-do-I-pass-parameters-to-my-SQL-statement/m-p/119671

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I used this same solution , by creating a report level parameter - it does work fine.

 

 

I wanted to see if I can do the same using Timeline Slicer.

Hi @sqldev2017,



I used this same solution , by creating a report level parameter - it does work fine.

 

I wanted to see if I can do the same using Timeline Slicer.


As far as I know, it is not possible to use a Timeline Slicer in this scenario currently. Smiley Happy

 

Regards

dont think so, not in imported mode.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.