Forum Discussion
Date parameter not working
- 3 years ago
Hi TurgayEsen
You may try setting up your pdate parameter to Date/Time data type, then using Date.ToText(DateTime.Date(pdate)) in your M query.
Reference: Considerations and limitations section from Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
I took SQL Server database for a test. When I set the parameter pDate as Date data type, I had an error similar to yours. However, when I set the parameter to Date/Time type, this error disappeared and everything worked as expected. Below is my test result.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi TurgayEsen
You may try setting up your pdate parameter to Date/Time data type, then using Date.ToText(DateTime.Date(pdate)) in your M query.
Reference: Considerations and limitations section from Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
I took SQL Server database for a test. When I set the parameter pDate as Date data type, I had an error similar to yours. However, when I set the parameter to Date/Time type, this error disappeared and everything worked as expected. Below is my test result.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.