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
ElsieCassin
Regular Visitor

The field 'ExpiryDateTest' of the record wasn't found. When creating a Custom Column

Hi,

I think I may have the Syntax for my Custom Column wrong, because my column ExpiryDateTest exists before the step to create the Custom column, but it dissappears after the step (see screenshots below)

My Add Custom1 command is:
Table.AddColumn(#"Renamed Columns", "Expired", each if [#"ExpiryDateTest"] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Not-Expired").

Can anyone help me with what I have wrong in my Add Custom syntax?

Many thanks..

 

ElsieCassin_2-1652871775408.png

 

ElsieCassin_0-1652871702343.png

 

1 ACCEPTED SOLUTION

I see that the previos step before Added Custom1 is "Changed Type1", however you are using "Renamed Columns"

Can you once try:

Table.AddColumn(#"Changed Type1", "Expired", each if [#"ExpiryDateTest"] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Not-Expired")

If this doesn't work, please provide the sample file removing all the sensitive data to have a better understanding of the issue.

View solution in original post

6 REPLIES 6
PC2790
Community Champion
Community Champion

Try:

Table.AddColumn(#"Renamed Columns", "Expired", each if [ExpiryDateTest] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Not-Expired").

Hi PC2790,

Thanks for your rply. 

I believe I've already tried this, but I copied and pasted your syntax and get the same message.

Just to clarify I see the below after creating the Custom Column

ElsieCassin_0-1652883813924.png

Then when I click on the field selector, its shows that the ExpriyDateTetst field is still there, but its not in the selection list.  
When I de-select everything but the ''Expired' field, the ExpiryDateTest field disappers from the and all the rows in the collumn show Error.
Before creating the custom field, I used the ExpiryDateTest columnin a report and it brought back data.

 

I see that the previos step before Added Custom1 is "Changed Type1", however you are using "Renamed Columns"

Can you once try:

Table.AddColumn(#"Changed Type1", "Expired", each if [#"ExpiryDateTest"] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Not-Expired")

If this doesn't work, please provide the sample file removing all the sensitive data to have a better understanding of the issue.

Hi PC2790,


Thanks for your help.  Yes apologies, I'd missed that I was still referrring to an old step!  I'll mark as solved!  Cheers...

amitchandak
Super User
Super User

@ElsieCassin , I doubt the column name , it should be simply ExpiryDateTest

 

While creating a column, select from the right had side selection

 

if [ExpiryDateTest] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Not-Expired"

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi amitchandak,
Yes I tried this also, but see the same result

ElsieCassin_1-1652884745140.png

 

ElsieCassin_2-1652884791860.png

 

 

 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.