Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hey all,
I have a problem when i try to add a column in excel in the last one and when i refresh the data flow relative with sharepoint path. It can not be added because in the first 4 excel doesnt exist this column and i have to write manually. I can do that for 4 excel but after 100 excel and if we want to add add one more column in 101 excel i have to write all filter again and again. How can I add a column automaticly. I mean i want to create a function which helps to scan every column and if there is a value bring this value in any case if there is not value, i dont want to see this null column.
Hi @v-jingzhang,
Thank you so much for answer. However it didnt work tho. Actually I used 2 source transformation and inside of one source I am using a function that I work on it. I have to fix this function than it will work for sure. I want to bring datetime, attribute and value column as well.
My excel table is someting like this =
and I´d like to add one more column in the last excel file for example B005 but although there is no column something like b005 in the last excel files so i am getting error like there is no column which is B005 so we it can´t bring this column as well.
Here you can see my function and i tried to apply it but it didn´t work. If you help me further, I will be really appreciated.
Hi @Anonymous
You can use Table.ColumnNames function to get all existing column names of a table and check whether a column exists among them.
Add a custom step in the formula bar with below code and modify "previous step" accordingly. When the column you are finding exists, it will return the table as it is. When the column doesn't exist, it will add a column with this column name. I'm not sure what result you want to add in the new column so I use null as an example. You can modify the results per your need.
= if List.Contains(Table.ColumnNames(#"previous step"), "findingColumnName") then #"Changed Type" else Table.AddColumn( #"previous step", "findingColumnName", each null)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Check out the July 2025 Power BI update to learn about new features.