cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Narender
Resolver I
Resolver I

Add a column in Power BI existing table

Hi All,

 

I have a table and I want to add a coulmn in that table Suppose Column_Flag in TableA.

 

Also I want to insert a charcter in each row of Column_Flag.

Menas Cloumn_Flag=A  .

 

Whenever a new record comes in TableA then it will automatically insert Cloumn_Flag=A against that new record.

 

 

Please let me know , How to achieve this.

 

 

Thanks,

 

Narender

1 ACCEPTED SOLUTION
Thejeswar
Solution Sage
Solution Sage

Hi @Narender,

If this new column to be added is not based on Any Conditions, i.e. If all the Entries in Column_Flag will be equal to 'A', just that the colmn should be automatically populated whenever new data comes, then you can achieve it using "Column From Examples" option in the Add Column of the Power Query Ribbon. Sames is show in the below pics

Add Column from ExampleAdd Column from ExampleYou just directly specify a Character for it to be repeated in all rowsYou just directly specify a Character for it to be repeated in all rows

 

 

 

 Hope this solves your issue!!!

 

 

View solution in original post

7 REPLIES 7
Seward12533
Solution Sage
Solution Sage

PowerQuery (get data) does not retain or archive older data so it has no way to tell if the record is old or new.  This needs to be handled with whatever system is creating the records. I usually request they add a Creation_Date and/or Modificaton_Date on each records. If you have that you can use filters adn time inteligence to compare against baseline, identify new records created within the last x days or whatever your trying to do.

HiSwerd,

 

I am using this for other Purpose.

 

I need to add this new column because i want to append this table with other table. For distinguish , I am using this new column as a flag.

 

 

Thanls,

 

Narender

What is the M code for the step that is inserting the A? If you don’t have the formula bar on you can turn it on under view ribbon. Or it may just be better if you paste your query? To do those choose advanced editor from the main ribbon.

Rather than using column from examples just add column with “A” in the formula window.
Thejeswar
Solution Sage
Solution Sage

Hi @Narender,

If this new column to be added is not based on Any Conditions, i.e. If all the Entries in Column_Flag will be equal to 'A', just that the colmn should be automatically populated whenever new data comes, then you can achieve it using "Column From Examples" option in the Add Column of the Power Query Ribbon. Sames is show in the below pics

Add Column from ExampleAdd Column from ExampleYou just directly specify a Character for it to be repeated in all rowsYou just directly specify a Character for it to be repeated in all rows

 

 

 

 Hope this solves your issue!!!

 

 

View solution in original post

Hi Thejeshwar,

 

I did the same. But find a P value also.

 

So now I am trying to delete the new column and creating again.

 

I need to add this new column because i want to append this table with other table. For distinguish , I am using this new column as a flag. 

 

Thanks,

 

Narender

Hi Thejeswar,

 

I did the same . But I saw there is some different value P found in my new created column but in actual i inserted the A.

 

So some places i found P rather than A

 

Due to this i am not getting my correct data.

 

 

Thanks,

 

Narender

Hi @Narender,

I tried recreating your scenario, but I was not able to. How many ever columns I insert, the same A is getting populated in all records.

 

Ideally, unless you specify some pattern for your data, all the rows will be populated as 'A' undoubtedly.

 

In case if you are importing data using SQL Query from a Database, you can also specify there, a new column with a static value of 'A'

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors