The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I used an SQL statement to get the data from a stored procedure. In this statement i use a date field and works fine when i use a variable as startdate.
The variable (startdate) is defined as:
#date(2018, 3, 6) meta [IsParameterQuery=true, Type="Date", IsParameterQueryRequired=true]
Now i want that the default date (2018, 3 ,6) changed to the present date. How can i do this?
when i use "DateTime.Date(DateTime.LocalNow())" for the date, the syntax doen't work
With kind regards,
The stored procedure is: exec storedprocedure '2018-03-07', '2018-03-07'
the 2 dates must be default the date of today (Startdate and Enddate)
for these dates I made a variabele and implemented it in de sourcecode:
Source = Sql.Database("xx", "xxx", [Query="exec storedprocedure '"&Date.ToText(Startdate"yyyyMMdd")&"', '"&Date.ToText(Endate,"yyyyMMdd")])
But now i have to change everyday the variable to the date of today. How can i change this default?
Startdate = #date(2018, 3, 7) meta [IsParameterQuery=true, Type="Date", IsParameterQueryRequired=true]
The syntax for "DateTime.Date(DateTime.LocalNow())" looks good, it returns todays date.
Maybe it's in the wrong format for your stored procedure?