Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

To automate data load with system date

Hi All,

 

I have a dashboard for which data is coming from stored procedures in SQL server. I want my dashboard to have the lastest data.

Can anyone suggest me how yo automate the data load into Power BI with system date.

 

The stored procedures run when we give system date as input parameter.

 

 

Please suggest

 

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    HI Anonymous,

    It seems like you missed the right 'quotation' in your query that stored the 'store procedures', please add it to confirm if the issue fixed:

     

        Source =
            Sql.Database(
                "test",
                "test",
                [
                    Query =
                        "DECLARE @return_value int EXEC @return_value = [dbo].[usp_Response_SLA] @date = "
                        & Date.ToText(Date.From(DateTime.LocalNow()),"MM/dd/yyyy")
                ]
            )

     

    snapshot

    Notice:

    1.'02-09-2021' will be generated by the right part M query function, you not need to add them to your query.

    2. I also modify the generated date functions to get the same format as you shared.

    Regards,

    Xiaoxin Sheng

6 Replies