Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I have a situation where I need to add columns dynamically if the column is not available. Say for e.g. I have 4 predefined columns [A, B, C, D] and I have a table "Data" with columns [Sno, Date, B, D].
Now I want to iterate to check if [A,B,C,D] all predefined columns are available in table "Data", I am trying to use accumulate to find out if it can be achieved in the below fashion or is there a better way to solve this issue.
= List.Accumulate({"A","B","C","D"}, "Data"}, Table.ColumnNames(#"Data"),
(original, current) =>
if !(Table.Hascolumns[current],original) then
Table.AddColumn(original,current[], each [current]))
Solved! Go to Solution.
Hi @sendilc ,
I'd just predefine all the columns that should be present in a blank table, then append the actual imported table onto it.
Here, Chris Webb explains it better than me:
Pete
Proud to be a Datanaut!
Hi @sendilc ,
I'd just predefine all the columns that should be present in a blank table, then append the actual imported table onto it.
Here, Chris Webb explains it better than me:
Pete
Proud to be a Datanaut!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |