Noelia Sancho Mendez
Noelia Sancho Mendez

Reputation: 151

Creating a Custom Column from CurrentDate

I'm trying to create a new custom column from a conditional statement and current date.

Next picture explains exactly what i need to get with power query.

THIS IMAGE EXPLAIN WHAT I WANT TO DO

An example of what I need from pseudocode is:

if [fecha fin de plazo]>=CurrentDate and [fecha CIERRE investigación]=null
then "string"

My biggest problem is I don't know how to extract the current date with PowerQuery.

Upvotes: 0

Views: 1190

Answers (2)

Noelia Sancho Mendez
Noelia Sancho Mendez

Reputation: 151

Using the DateTime.LocalNow you get the date and time of your system, the problem is at time to compareting the date value with the result of DateTime.LocalNow() becsause you need to compare only dates.

That's why It must use DateTime.Date. This fucntion returns the date component of DateTime.LocalNow().

if [date1] >= DateTime.Date(DateTime.LocalNow()) and [date2]=null
then "string"

You can get more information about this functions here:


DateTime.LocalNow()
DateTime.Date()

Upvotes: 1

Mboolean
Mboolean

Reputation: 392

You could try using,

if [fecha fin de plazo]>= DateTime.LocalNow() and [fecha CIERRE investigación]=null
then "string"

DateTime.LocalNow()

Upvotes: 1

Related Questions