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

Join 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.

Reply
Anonymous
Not applicable

Renaming multiple columns after API import

Hi 

I have imported a API request to PowerBi. All fine. 

I can see the import have predefine the colunm name with "Value." and name ect. "Value.dashboard"

 

bajlumbusch_0-1615891252725.png

 

It's possible to automatic renaming multiple columns and remove "Column." in the column name? There is over 50 columns I need to remove. Thanks.  

 

Data in Power Query 

let
Kilde = Json.Document(Web.Contents("https://geniebelt.letsbuild.com/api/mulan/projects", [Headers=[Authorization="API-KEY"]])),
#"Konverteret til tabel" = Record.ToTable(Kilde),
#"Udvidet Value" = Table.ExpandListColumn(#"Konverteret til tabel", "Value"),
#"Udvidet Value1" = Table.ExpandRecordColumn(#"Udvidet Value", "Value", {"dashboard_image_url", "subscription_plan_code", "subscription_type", "estimated_progress", "logo_image_url", "work_duration", "estimated_latitude", "estimated_longitude", "company_id", "partner", "default_team_id", "attachments_ids", "country_calendar", "id", "updated_at", "created_at", "name", "owner_id", "ticket_number", "project_description", "budget", "start_date", "end_date", "progress", "cover_attachment_id", "project_subscription_id", "archived_at", "logo_attachment_id", "latitude", "longitude", "address", "timezone", "estimated_address", "locked", "reference", "custom_settings", "custom_fields", "hash", "owner", "attachments"}, {"Value.dashboard_image_url", "Value.subscription_plan_code", "Value.subscription_type", "Value.estimated_progress", "Value.logo_image_url", "Value.work_duration", "Value.estimated_latitude", "Value.estimated_longitude", "Value.company_id", "Value.partner", "Value.default_team_id", "Value.attachments_ids", "Value.country_calendar", "Value.id", "Value.updated_at", "Value.created_at", "Value.name", "Value.owner_id", "Value.ticket_number", "Value.project_description", "Value.budget", "Value.start_date", "Value.end_date", "Value.progress", "Value.cover_attachment_id", "Value.project_subscription_id", "Value.archived_at", "Value.logo_attachment_id", "Value.latitude", "Value.longitude", "Value.address", "Value.timezone", "Value.estimated_address", "Value.locked", "Value.reference", "Value.custom_settings", "Value.custom_fields", "Value.hash", "Value.owner", "Value.attachments"}),
#"Udvidet Value.owner" = Table.ExpandRecordColumn(#"Udvidet Value1", "Value.owner", {"company_name", "company_id", "profile_picture_url", "profile_picture_medium_url", "attachments_ids", "language", "phone_number_formatted", "last_sign_in_at", "confirmed_at", "unconfirmed_email", "partner", "id", "updated_at", "created_at", "email", "phone_number", "first_name", "last_name", "hash", "attachments"}, {"Value.owner.company_name", "Value.owner.company_id", "Value.owner.profile_picture_url", "Value.owner.profile_picture_medium_url", "Value.owner.attachments_ids", "Value.owner.language", "Value.owner.phone_number_formatted", "Value.owner.last_sign_in_at", "Value.owner.confirmed_at", "Value.owner.unconfirmed_email", "Value.owner.partner", "Value.owner.id", "Value.owner.updated_at", "Value.owner.created_at", "Value.owner.email", "Value.owner.phone_number", "Value.owner.first_name", "Value.owner.last_name", "Value.owner.hash", "Value.owner.attachments"}),
#"Udvidet Value.owner.attachments" = Table.ExpandListColumn(#"Udvidet Value.owner", "Value.owner.attachments"),
#"Udvidet Value.attachments" = Table.ExpandListColumn(#"Udvidet Value.owner.attachments", "Value.attachments")
in
#"Udvidet Value.attachments"

2 REPLIES 2
Anonymous
Not applicable

try this (warning: not tested!!!)

 

let
Kilde = Json.Document(Web.Contents("https://geniebelt.letsbuild.com/api/mulan/projects", [Headers=[Authorization="API-KEY"]])),
#"Konverteret til tabel" = Record.ToTable(Kilde),
#"Udvidet Value" = Table.ExpandListColumn(#"Konverteret til tabel", "Value"),
#"Udvidet Value1" = Table.ExpandRecordColumn(#"Udvidet Value", "Value", {"dashboard_image_url", "subscription_plan_code", "subscription_type", "estimated_progress", "logo_image_url", "work_duration", "estimated_latitude", "estimated_longitude", "company_id", "partner", "default_team_id", "attachments_ids", "country_calendar", "id", "updated_at", "created_at", "name", "owner_id", "ticket_number", "project_description", "budget", "start_date", "end_date", "progress", "cover_attachment_id", "project_subscription_id", "archived_at", "logo_attachment_id", "latitude", "longitude", "address", "timezone", "estimated_address", "locked", "reference", "custom_settings", "custom_fields", "hash", "owner", "attachments”}),
#"Udvidet Value.owner" = Table.ExpandRecordColumn(#"Udvidet Value1", "Value.owner", {"company_name", "company_id", "profile_picture_url", "profile_picture_medium_url", "attachments_ids", "language", "phone_number_formatted", "last_sign_in_at", "confirmed_at", "unconfirmed_email", "partner", "id", "updated_at", "created_at", "email", "phone_number", "first_name", "last_name", "hash", "attachments"} ),
#"Udvidet Value.owner.attachments" = Table.ExpandListColumn(#"Udvidet Value.owner", "Value.owner.attachments"),
#"Udvidet Value.attachments" = Table.ExpandListColumn(#"Udvidet Value.owner.attachments", "Value.attachments")
in
#"Udvidet Value.attachments"
edhans
Super User
Super User

I'm not 100% clear on what you need to do @Anonymous but you should not "Remove Columns" here. You should "Remove Other Columns" which is to say, Power Query will use Table.SelectColumns. In other words, keep what you want, and the rest will be discarded.

 

If you want to rename columns dynamically based on their position if you don't know their incoming name all of the time, you can take a look at this blog I wrote that will help you explain it.

 

Otherwise, we will need to see some data and expected results. And when pasting code, please use the code box in the 2nd toolbar ribbon - </>

How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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