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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
blackanese27
Frequent Visitor

Expression. Error The field 'Content' of the record wasn't found.

Hello. First time poster here. I'm new to PowerBI but not to Data Manipulation. I've browsed around the board but haven't found a solution yet. I recently transitioned into a career in Data Analytics. I'm one of two Data Analysts and am currently fixing the previous Analysts Queries & Connections for a board presentation that I have at the end of the month. 

 

I've been working over the past week on fixing queries and connections for work that I received from the previous analyst. They didn't do a good job of labeling their items unfortunately which has been tough to figure out.The field 'Content" is only present in the 1st step and afterwards it's no longer present in the data. 

 

Here's the first chunk of code, wasn't sure if it was necessary for me to share the rest. 

 

Screenshot for PowerBI 4.png

 

This is the column that's being referenced. The creator of the Query appended CSV folders together.screenshot for reddit 2.png

 

Screenshot for Reddit 3.png

 

Screenshot for Reddit Expression Error.png

 

Thanks!

1 ACCEPTED SOLUTION

Hi @blackanese27 ,
it would work like so:

Source = Folder.Files("K:\Admin\Business Analyst\A-Analyst Secured\Projects\2021 Property Equity Analysis\Data\Original\Cascade\Resident Demographics"),
#"Filtered Hidden Files2" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function2" = Table.AddColumn(#"Filtered Hidden Files2", "Transform File (4)", each TransformSteps([Content])),
#"Removed Other Columns2" = Table.SelectColumns(#"Invoke Custom Function2", {"Name", "Transform File (4)", "Content"}),

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

6 REPLIES 6
ImkeF
Super User
Super User

Hi @blackanese27 ,

I you paste your m-code here as text instead of an image, I can exactly show you where to put that.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

I pasted the first 4 lines of code just in case. I appreciate your help!

 

Source = Folder.Files("K:\Admin\Business Analyst\A-Analyst Secured\Projects\2021 Property Equity Analysis\Data\Original\Cascade\Resident Demographics"),
#"Filtered Hidden Files2" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function2" = Table.AddColumn(#"Filtered Hidden Files2", "Transform File (4)", each TransformSteps([Content])),
#"Removed Other Columns2" = Table.SelectColumns(#"Invoke Custom Function2", {"Name", "Transform File (4)"}),

 

 

Hi @blackanese27 ,
it would work like so:

Source = Folder.Files("K:\Admin\Business Analyst\A-Analyst Secured\Projects\2021 Property Equity Analysis\Data\Original\Cascade\Resident Demographics"),
#"Filtered Hidden Files2" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function2" = Table.AddColumn(#"Filtered Hidden Files2", "Transform File (4)", each TransformSteps([Content])),
#"Removed Other Columns2" = Table.SelectColumns(#"Invoke Custom Function2", {"Name", "Transform File (4)", "Content"}),

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

*Excuse my language but holy **bleep** it worked! Thanks so much for your help. 

It's another Query that's supposed to be pulling data from the Query you helped me with combined with one that I fixed myself and it's taking forever to load. I created a separate document and saved the edits that you suggested. What's the longest that you've seen documents to load? Any tips? The files that are being used are CSV's but it's still taking a long time to load. 

 

Thanks again for your help!

ImkeF
Super User
Super User

Hi @blackanese27 ,
yes, in the 4th steps ("Removed Columns2") that field will be removed and can therefore not be referenced later.
Just add its column name to the list of names in the 2nd function argument and you have it in again for later reference.
However, it could of course be that there is a different error in your query and the step that is now lacking the content field should actually reference a different table (where this column is still contained). How knows, if a query is broken like that... You will have to try it out.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Thanks for the response lmkeF. Where in particular would I add the 'Content' field in the second argument? Would it be with [Attributes]? [Hidden]?  When I tried that, I got another Expression Error

 

Expression.Error: We cannot convert a value of type Binary to type List.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors