Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
NumeroENAP
Helper III
Helper III

Replace future dates by today date

Hi, I'm wondering what I'm doing wrong :

 

= Table.ReplaceValue(#"Column", "Date created", each if [Date created] > DateTime.FixedLocalNow() then DateTime.FixedLocalNow() else [Date created])

 

Thanks!

2 ACCEPTED SOLUTIONS
Jimmy801
Community Champion
Community Champion

Hello @NumeroENAP 

 

as far as I know the function Table.ReplaceValue just replaces and old value with a new value. Use this syntax instead (not tested)

 

= Table.TransformColumns
  (
      #"Column", 
      {
         {
            "Date created", 
            each if _ > Date.From(DateTime.FixedLocalNow()) then Date.From(DateTime.FixedLocalNow()) else _,
            type date
         }
      }
   )

 


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

View solution in original post

TheDataMustFlow
Frequent Visitor

Try:

 

= Table.ReplaceValue(#"Column", "Date created", each if DateTime.FromText([Date created])> DateTime.FixedLocalNow() then DateTime.FixedLocalNow() else [Date created])

View solution in original post

7 REPLIES 7
Jimmy801
Community Champion
Community Champion

Hello @NumeroENAP 

 

then it would be correct that the correct post is marked as solution

 

many thanks

 

Jimmy

Jimmy801
Community Champion
Community Champion

Hello @NumeroENAP 

 

just saw that this formula was accepted as solution.

Table.ReplaceValue(#"Column", "Date created", each if DateTime.FromText([Date created])> DateTime.FixedLocalNow() then DateTime.FixedLocalNow() else [Date created])

it can not work, did it?

 

All the best

 

Jimmy

Sorry @Jimmy801 , in fact, I worked around the answer that he gave me and it worked. 

 

But I corrected the situation and gave you the proper credit. 

 

Thanks for the answer!

Hello @NumeroENAP 

 

your feedback i very appreciated

 

Jimmy

@Jimmy801, you are correct. My suggestion makes it accept teh formula without giving an error, but doesn't change the date as intended.

Your answer should be the one marked as solution as it returns the expected result in onwe step.

TheDataMustFlow
Frequent Visitor

Try:

 

= Table.ReplaceValue(#"Column", "Date created", each if DateTime.FromText([Date created])> DateTime.FixedLocalNow() then DateTime.FixedLocalNow() else [Date created])

Jimmy801
Community Champion
Community Champion

Hello @NumeroENAP 

 

as far as I know the function Table.ReplaceValue just replaces and old value with a new value. Use this syntax instead (not tested)

 

= Table.TransformColumns
  (
      #"Column", 
      {
         {
            "Date created", 
            each if _ > Date.From(DateTime.FixedLocalNow()) then Date.From(DateTime.FixedLocalNow()) else _,
            type date
         }
      }
   )

 


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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors