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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nephologist
Frequent Visitor

New column in source not appearing in dataset

I recently added another column to the .csv files I'm using as source for a dataset, and Power BI will not read the new column.

 

It's a similar problem with the one posted over here:

https://community.powerbi.com/t5/Desktop/New-column-in-source-table-not-appearing-in-dataset-after/t...

 

Unfortunately, I'm drawing the .csv files from an entire folder, so my Advanced Editor starts off with something like this:

 

Source = Folder.Files("some path"),

 

so the solution in the post doesn't really work for me.

 

How can I make Power BI read all the columns in each .csv file?

 

Thanks in advance.

1 ACCEPTED SOLUTION

OK, when you created your Folder query, it should have created a folder in Query Editor called something like "Transform File from csvs". In that folder should be a "Transform Sample File from csvs". Click on that and then click on Advanced Editor and edit the Source line in that query as specified above.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

9 REPLIES 9
parry2k
Super User
Super User

If I understood your question correclty, you have multiple csv files with same data structure and you want to read all those files, correct?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Correct.

 

And the .csv files were being read before just fine, until I added a new column to each of them. Now the new column is not being read.

Open up Advanced Editor in Query Editor, find the Source line and change the number of columns that are specified.

 

So, if your Source line is this:

 

    Source = Csv.Document(File.Contents(OneSource1),[Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None]),

And you add a column, change it to this:

 

    Source = Csv.Document(File.Contents(OneSource1),[Delimiter=",", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

do you have remove column or select column steps in your query editor? May be you need to revisit one of those steps.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Yes.

 

The steps I had before are as follows:

 

Source = Folder.Files("D:\file path\FILE NAME"),
#"Invoke Custom Function" = Table.AddColumn(Source, "Transform File from FILE NAME", each #"Transform File from FILE NAME"([Content])),
#"Renamed Columns" = Table.RenameColumns(#"Invoke Custom Function", {"Name", "Source.Name"}),
#"Removed Other Columns" = Table.SelectColumns(#"Renamed Columns",{"Source.Name", "Transform File from FILE NAME"}),

 

I don't see if the select function is somehow choosing or limiting the number of columns in the source...

 

@Greg_Deckler I can't use that solution since I'm extracting the files from an entire folder, and the Advanced Editor doesn't start with "Source = Csv.Document"

So from your query it looks like you are calling a function to read data from each file. You need to check that function to make sure it is reading all the columns, and change the query in the function as @Greg_Deckler suggested or look if you remove/selected column step in that function.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

OK, when you created your Folder query, it should have created a folder in Query Editor called something like "Transform File from csvs". In that folder should be a "Transform Sample File from csvs". Click on that and then click on Advanced Editor and edit the Source line in that query as specified above.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Sweet, that worked. Thank you.

 

So I guess every time I add something to the source I have to do this all over again, right? Is there a way to automatize it? I'm thinking, instead of "Columns=5" or any number, "Columns=All"?

"Columns" is optional, so you can leave it out completely.

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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