0

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.

2 Answers 2

1

You could try using,

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

DateTime.LocalNow()

Sign up to request clarification or add additional context in comments.

2 Comments

almost! your code returns me an error but I was from your request I found out what I needed. To make it work properly I added DateTime.Date() to DateTime.LocalNow(). The result was DateTime.Date(DateTime.LocalNow()) because your code returns me date and time and I'm comparing the columns just by date
@NoeliaSanchoMendez glad you found a way. Though I don't have any way to test given code :)
1

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()

2 Comments

Please consider adding at least some explanation as though why this answer the question
Please add some description to your code explaining what is going on and why. This is good practice. If you don't, your answer is in risk of being deleted. It has already been flagged as low quality.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.