Forum Discussion
How to convert date to datetime for incremental refresh
- Anonymous4 years ago
Hi lt79_Pax ,
The data type of the RangeStart and RangeEnd parameters must be of date/time data type. However, for many data sources, tables don't have a column of date/time data type but instead have a date column of integer surrogate keys in the form of
yyyymmdd. You can create a function that converts the date/time value in the parameters to match the integer surrogate key of the data source table. The function is then called in a filter step. This step is required if the data source table contains only a surrogate key as integer data type.Best Regards,
Jay
The function DateTime.From should work to convert date to datetime data type.
Hi AlexisOlson,
Thank you for the function however I am not familiar with M code. How would I use this function for the converting a field in preparation for an incremental refresh? If my column field name was InvoiceDate set as a date. How would this function look? DateTime.From(InvoiceDate)? When I use this I receive an error message. It also created a change type which will not work with an incremental refresh. Therefore, how would I use this function? What would be the syntax if the field InvoiceDate is of type date and I need to convert it to date/time without creating a column but invoking a function. = (x as date)=>Datetime.from(x). If I try this I also get another error message. I am afraid I just do not understand how this function can be used. Please advise.
Thank you.