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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
damit23183
Microsoft Employee
Microsoft Employee

Index ID from Date Column using Power Query

Hi,

 

I have a Date Column and would like to create INDEX column based on Date values.

 

For example;

 

I have Date Column as show in below figure and from Date Column I want to create ID (Index Column) column using Power Query.

 

Table.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NOTE: I have dates info for almost 40 Years. (1994-2034)

Any suggestion/Help Appreciate!

 

Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@damit23183 , Create a new column like

Date.ToText([Date], "yyyyMMdd")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@damit23183 , Create a new column like

Date.ToText([Date], "yyyyMMdd")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks Amit it worked.

 

 

Thanks

PhilipTreacy
Super User
Super User

Hi @damit23183 

Try this.  It's loading a column of dates from a table called Dates

 

 

let
    Source = Excel.CurrentWorkbook(){[Name="Dates"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type datetime}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "ID", each Text.From(Date.Year([Date])) & Text.PadStart(Text.From(Date.Month([Date])),2,"0") & Text.PadStart(Text.From(Date.Day([Date])),2,"0"))
in
    #"Added Custom"

 

 

I'm using d/m/y/ not sure what you have.  You may need to swap around the Date.Month and Date.Day parts of the query.

Phil 


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you Philip for your inputs. 

 

Rellay appreciate it!

Helpful resources

Announcements
60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.