1

I'm doing my very first steps in Power Query UDFs. My goal is the function result like (Excel) DATE (). This is how I reach the goal:

() => Date.From (DateTime.LocalNow ())

The result is correct, but the data type is "any". I want the data type to be Date instantly. How can I integrate this into the function?

Max Vollmer
  • 8,412
  • 9
  • 28
  • 43

1 Answers1

0

You can specify the type to be a date like this:

() as date => Date.From (DateTime.LocalNow ())

The whole query will look like this:

let
    Source = () as date => Date.From (DateTime.LocalNow ())
in
    Source

If you had a parameter, you can specify its type as well. For example,

let  
    AddOne = (x as number) as number => x + 1
in  
    AddOne
Alexis Olson
  • 38,724
  • 7
  • 42
  • 64