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
Espenblo
Frequent Visitor

Replacing a Datekey in integer format with todays date as integer

Hi,

 

I have a table with a datekey column as an integer on the form yyyymmdd. I want to replace the values 10010101 to today's date in power query. So today I will want to replace 10010101 to 20230609. Is there any way I can do this?

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi,

add Number.FromText

 Table.ReplaceValue(Previous_Step,10010101,Number.FromText(DateTime.ToText(DateTime.LocalNow(),"yyyyMMdd")),Replacer.ReplaceValue,{"Date"})

Stéphane 

View solution in original post

3 REPLIES 3
slorin
Super User
Super User

Hi,

add Number.FromText

 Table.ReplaceValue(Previous_Step,10010101,Number.FromText(DateTime.ToText(DateTime.LocalNow(),"yyyyMMdd")),Replacer.ReplaceValue,{"Date"})

Stéphane 

slorin
Super User
Super User

Hi,

 

= Table.ReplaceValue(Previous_Step,10010101,DateTime.ToText(DateTime.LocalNow(),"yyyyMMdd"),Replacer.ReplaceValue,{"Date"})

Stéphane 

I see that this solution returns the value as text, is it possible to change it to integer?

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