Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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", each if [PostedPO.Posting_Date] >= #date(today()) then "yes" else null)
Solved! Go to Solution.
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
https://www.instagram.com/tackytechtom
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi @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
https://www.instagram.com/tackytechtom
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
In the 'Custom Column' box you just need to enter this part...
if [PostedPO.Posting_Date] >= Date.AddDays(DateTime.LocalNow(),-1)) then "yes" else null
Not from the "Table.AddColumn...."
If this works, please accept Tom's answer as the solution, not this one.
Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
If you found this post helpful, please give Kudos. It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen. If you find my signature vaguely amusing, please give Kudos. | Proud to be a Super User! |
I am also getting this error
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
Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
If you found this post helpful, please give Kudos. It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen. If you find my signature vaguely amusing, please give Kudos. | Proud to be a Super User! |
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
https://www.instagram.com/tackytechtom
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi @Atinder ,
how about this:
Date.AddDays(DateTime.LocalNow(),-1)
/Tom
https://www.instagram.com/tackytechtom
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi @Atinder ,
This code snippet might help you:
Table.AddColumn(#"Expanded PostedPO", "Custom", each if [PostedPO.Posting_Date] >= Date.From(DateTime.LocalNow()) then "yes" else null)
Let me know!
/Tom
https://www.instagram.com/tackytechtom
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Solution works. How can I look yesterday's posting date. I tried to put -1 after now()-1 but it is not working.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
54 | |
21 | |
12 | |
11 |