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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
struggle
Helper I
Helper I

Creating custom columns keeps returning a structured Table column

For example, since Power Query isn't able to autoconvert the column Date, which is in yyyymmdd format, into date format, I've been trying to convert it using different custom column calculations, but every time I attempt this, I either get an error or a structured column filled with Table links. When I try to expand the resulting Proper Date column, I end up with extra rows. How do I fix this?

struggle_0-1753285445641.png

 

1 ACCEPTED SOLUTION

If you are using the UI to add a column you do not need to write "Table.AddColumn". You would only need to write everything you have after the 'each' 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

15 REPLIES 15
jgeddes
Super User
Super User

Power Query will convert that date column to a date format if you specify the culture it needs. 
https://learn.microsoft.com/en-ie/powerquery-m/date-from 
The Date.From and Date.FromText functions both have that ability.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





My default is en-US, though - I don't see how specifying en-US would change that, or what culture I would have to specify othrewise. My main is that the output comes as links to a separate Table.

What code are you writing to add your column that results in a table?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





MasonMA
Memorable Member
Memorable Member

@struggle 

 

Hi, you may need to change your data in 'Date' column to a 'Text' data type before your Add Column step. 

MasonMA_0-1753288134061.png

I used some random data and gave it a try with below M and it works

= Table.AddColumn(#"Changed Type", "Custom", each #date(
    Number.FromText(Text.Start([Date], 4)),
    Number.FromText(Text.Middle([Date], 4, 2)),
    Number.FromText(Text.End([Date], 2))
))

 

MasonMA_1-1753288227310.png

 

Hope it helps:)

I do get the correct dates, but they're still behind Table links in the resulting column.

struggle_0-1753295275695.png

 

Now I'm not sure i understand your question.

 

Could you paste all your M code here? 

I've tried both this

Table.AddColumn(Access_Table, "Proper Date", each 
let
DateNumber = [Date],
Year = Number.IntegerDivide(DateNumber, 10000),
Month = Number.IntegerDivide(Number.Mod(DateNumber, 10000), 100),
Day = Number.Mod(DateNumber, 100)
in
#date(Year, Month, Day)
)

and this

= Table.AddColumn(Access_Table, "Proper Date", each 
Date.FromText(Text.From([Date]), [Format="yyyymmdd"])
)

And the resulting column populates Table links instead of the calculated values:

struggle_0-1753301797576.png

For the second calculation, I get this error when I click through the Table links to see the values:

Parameter.Error: We couldn't use the specified value as a date format because it includes a time component.
Details:
Format=yyyymmdd

 

What does 

Table.AddColumn(#"Added Column", "Proper Date", each Date.From([Date]), type date)

return?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





struggle_0-1753302533711.png

 

Sorry, I wrote #"Added Column" instead of #"Added Custom". 
What is displayed if #"Added Custom" is used?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





DataFormat.Error: We couldn't convert to Date.
Details:
20250302

Oh I think I know what it might be - I'm clicking the Custom Column function, which adds an extra 

Table.AddColumn(Access_Table, "Custom", each Table.AddColumn(Access_Table, "Proper Date", each
let
DateNumber = [Date],
Year = Number.IntegerDivide(DateNumber, 10000),
Month = Number.IntegerDivide(Number.Mod(DateNumber, 10000), 100),
Day = Number.Mod(DateNumber, 100)
in
#date(Year, Month, Day)
)) 
How do I add a custom column without incurring that code addition, or what do I omit?

If you are using the UI to add a column you do not need to write "Table.AddColumn". You would only need to write everything you have after the 'each' 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





That worked with this code below. Thanks!

let
DateNumber = [Date],
Year = Number.IntegerDivide(DateNumber, 10000),
Month = Number.IntegerDivide(Number.Mod(DateNumber, 10000), 100),
Day = Number.Mod(DateNumber, 100)
in
#date(Year, Month, Day)

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors