Forum Discussion
Using the dates from date slicer in queries to filter data for visualization
Clarifying on the question -
Correlating it with paramterised SSRS dashboards, where user has the ability to change the dates as required and the underlying queries fetch data based on those parameters, Is it possible to have similar ability for user in Power BI?
Select date range from date slicer and use the start and end date in underlying queries as there are multiple date fields in queries.
Any advise will be appreciated.
Slicer no works like Parameter that works in SSRS. Slicer only effect on Visual level. We cannot use slicer items in dataset or query. What you can do is use Power BI parameter in query. Please refer to the link below to see the details.
https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/
Regards,
Charlie Liao
- BIWhiz9 years agoFrequent Visitor
Thank you for your response.
I explored the parameters option , however I haven't been able to figure how how parameters can be changed by the user and the report/dashboard to show the related data.
Essentially. I am trying to use start date and end date (enterable by user) to filter rows in query based on conditions eg. Start date = '2017-05-01' and End Date '2017-05-31' then I need my queries to use these dates as filters - select [Empname],[EmpHireDate],[EmpTermDate] from Employee where EmpHireDate <='2017-05-31' and ( EmpTermdate IS NULL or EmpTermdate > '2017-05-31')
this will give me the active employees in that date range.
I did find a workaround though, it was not quite hard to implement. Any ideas will be appreciated.
- v-caliao-msft9 years ago
Microsoft Employee
- Aasish8 years agoFrequent Visitor
Hi BIWhiz, Can you please let me know what was the work around you implemented ?
- BIghost8 years agoRegular Visitor
Good Day,
I am also in this same situation - that I need to make use of the
'start date' and 'end date' in my queries for different date fields.
I will appreciate a feedback on this work-around. Also, Power BI should make the slicer componts' values usable in underlying queries. This desirable feature should be impletemented.
Please keep me posted.