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.
Hi all! This is my first post and I hope you can help me. I have the following problem to solve. I have this date column and my goal is that if the date in the "Fecha" (date) column is less than today, the value is replaced by today. If the date is equal to today or greater than the date is kept. This is in PowerQuery
Thanks you all!
Regards
Bruno Bentancor.-
Solved! Go to Solution.
Hi @Anonymous
You can create a custom column with code like this:
if [Fecha] >= Date.From(DateTime.LocalNow()) then [Fecha] else Date.From(DateTime.LocalNow())
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hello @Anonymous
if you want to avoid to multiple columns handling, you can transform the existing one
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTVMzTQMzJQitUBciyQOMYGSBwDQz0DS2SOBZgTCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Fecha = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Fecha", type date, "de-DE"}}),
TransformFecha = Table.TransformColumns
(
#"Changed Type",
{
{
"Fecha",
each if _ >= Date.From(DateTime.LocalNow()) then _ else Date.From(DateTime.LocalNow())
}
}
)
in
TransformFecha
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hi @Anonymous
You can create a custom column with code like this:
if [Fecha] >= Date.From(DateTime.LocalNow()) then [Fecha] else Date.From(DateTime.LocalNow())
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Excellent @AlB ! Thank you very much for your help 😄
It worked for me!
Regards!
Bruno Bentancor.-
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.