Forum Discussion
Atinder
Helper III
4 years agoAdd IF date formula in the custom date
Hello, I want to add a custom date column in the table by using IF function. I want to see what items I received today by the posting date. = Table.AddColumn(#"Expanded PostedPO", "Custom...
- 4 years ago
My bad, I used the wrong syntax.
How about this:
= Table.AddColumn(#"Changed Type", "Custom", each if [PostedPO.Posting_Date] >= Date.AddDays(Date.From(DateTime.LocalNow()), - 1) then "yes" else null)
/Tom
tackytechtom
Most Valuable Professional
4 years agoHi @Atinder ,
Does it work that way?
Table.AddColumn(#"Expanded PostedPO", "Custom", each if [PostedPO.Posting_Date] >= Date.AddDays(DateTime.LocalNow(),-1)) then "yes" else null)
Let me know!
/Tom
- KNP4 years ago
Super User
In the 'Custom Column' box you just need to enter this part...
if [PostedPO.Posting_Date] >= Date.AddDays(DateTime.LocalNow(),-1)) then "yes" else nullNot from the "Table.AddColumn...."
If this works, please accept Tom's answer as the solution, not this one.
- Atinder4 years ago
Helper III
I am also getting this error
- KNP4 years ago
Super User
Apologies, I copied the wrong text from tackytechtom's answer. Use the below instead.
Again, please accept Tom's answer if this solves your problem.
if [PostedPO.Posting_Date] >= Date.AddDays(Date.From(DateTime.LocalNow()), - 1) then "yes" else null
- tackytechtom4 years ago
Most Valuable Professional
My bad, I used the wrong syntax.
How about this:
= Table.AddColumn(#"Changed Type", "Custom", each if [PostedPO.Posting_Date] >= Date.AddDays(Date.From(DateTime.LocalNow()), - 1) then "yes" else null)
/Tom