Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Dynamic Parameters for a web link

Hey Everyone
I have a web link as 


" https:/xyz...cdata?startDate=$2023-11-01&endDate=$2023-11-30 "

Currently as you can see the dates are beind hardcoded. Is there a way I can dynamically pass the dates..


Thanks a lot 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Anonymous 

    Based on your description, you intend to pass the and parameters dynamically in the URL. You can try the following methods.

    1.Power BI Dynamic M Query Parameters If you are working in Power BI, you can utilize dynamic M query parameters for this purpose. These parameters can be defined in Power BI Desktop and allow the user to enter or choose to dynamically adjust the date of a data query. For a more detailed guide to setting up this setting, see the official documentation on Dynamic M Query Parameters: Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

    2. URL construction in applications. dynamic insertion of parameters is usually handled programmatically if URLs are to be constructed in custom applications such as web applications. This involves capturing user input for the start date and end date, and then constructing the URL string using these dynamic values before making the request. The exact implementation will depend on the programming language and framework you are using.

    Other considerations


    Ensure that any dynamically inserted dates are formatted correctly (YYYY-MM-DD) to match the expected format of the endpoint.
    Consider implementing error handling to manage the possibility that the date may not be provided or formatted correctly.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Anonymous 

    Based on your description, you intend to pass the and parameters dynamically in the URL. You can try the following methods.

    1.Power BI Dynamic M Query Parameters If you are working in Power BI, you can utilize dynamic M query parameters for this purpose. These parameters can be defined in Power BI Desktop and allow the user to enter or choose to dynamically adjust the date of a data query. For a more detailed guide to setting up this setting, see the official documentation on Dynamic M Query Parameters: Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

    2. URL construction in applications. dynamic insertion of parameters is usually handled programmatically if URLs are to be constructed in custom applications such as web applications. This involves capturing user input for the start date and end date, and then constructing the URL string using these dynamic values before making the request. The exact implementation will depend on the programming language and framework you are using.

    Other considerations


    Ensure that any dynamically inserted dates are formatted correctly (YYYY-MM-DD) to match the expected format of the endpoint.
    Consider implementing error handling to manage the possibility that the date may not be provided or formatted correctly.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum