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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
darylmitchell
Frequent Visitor

Changing Column Names

I have a weekly excel file of Monthly finance data.
The issue I have is the columns change.

As we go through the year the "E" after the month will turn to "A"  e.g. Last Month the 10th column would have been "Oct E (Sav)"

Jan A (Sav)Feb A (Sav)Mar A (Sav)Apr A (Sav)May A (Sav)Jun A (Sav)Jul A (Sav)Aug A (Sav)Sep A (Sav)Oct A (Sav)Nov E (Sav)Dec E (Sav)


I have already handled this by unpivoting these columns etc and also using Mquery functions like 
= Table.TransformColumnTypes(#"Removed Top Rows",List.Transform(Table.ColumnNames(#"Removed Top Rows"), each {_ , type text}))
To get the column types changed, referncing the name dynamically without had coding any names.

This all works fine in the desktop version of PowerBI.
But when I pass this to Enterprise to run automatically it fails as there seems to be some residual caching of column names.
Anyone know anything about this or had the same issue?



 

9 REPLIES 9
BA_Pete
Super User
Super User

Hi @darylmitchell ,

 

Are you able to share your full M query please?

Make sure to anonymise any sensitive information such as server names/file paths etc.

Power Query won't be caching any column names, so my guess is that you've got a rogue reference somewhere that's invoking them - it may be causing an in-cell error in Desktop that's not easily noticeable, but failing the refresh in the Service.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hi Pete.
Here are the column formats from different days.  The content isn't the issue only the column headers.
In PBI desktop running on my PC it seems to handle it, on enterprise it doesn't.

I know all possibilities there can be but have no control over the formats that are actually sent or the number of columns in the sheet.


 

11/10/202316-Oct30-Oct02/11/2023
Action #Action #Action #Action #
Fiscal YearFiscal YearFiscal YearFiscal Year
Status/RiskStatus/RiskStatus/RiskStatus/Risk
RBURBURBURBU
Country ClusterCountry ClusterCountry ClusterCountry Cluster
CountryCountryCountryCountry
Strategic UnitStrategic UnitStrategic UnitStrategic Unit
Business LineBusiness LineBusiness LineBusiness Line
Service TypeService TypeService TypeService Type
Service UnitService UnitService UnitService Unit
UnitUnitUnitUnit
Delivery OwnerDelivery OwnerDelivery OwnerDelivery Owner
DesigneeDesigneeDesigneeDesignee
Finance OwnerFinance OwnerFinance OwnerFinance Owner
Action TitleAction TitleAction TitleAction Title
TypeTypeTypeType
Impact TypeImpact TypeImpact TypeImpact Type
P&L BenefitP&L BenefitP&L BenefitP&L Benefit
P&L BeneficiaryP&L BeneficiaryP&L BeneficiaryP&L Beneficiary
Global InitiativeGlobal InitiativeGlobal InitiativeGlobal Initiative
Is Lean SupportedIs Lean SupportedIs Lean SupportedIs Lean Supported
Reporting CategoryReporting CategoryReporting CategoryReporting Category
Global ProgramGlobal ProgramGlobal ProgramGlobal Program
Finance ApprovalFinance ApprovalFinance ApprovalFinance Approval
Redeployment ApprovalRedeployment ApprovalRedeployment ApprovalRedeployment Approval
CategoryCategoryCategoryCategory
Sub CategoryCommentsSub CategorySub Category
Employment StatusSub CategoryEmployment StatusEmployment Status
Free Up TypeEmployment StatusFree Up TypeFree Up Type
Transfer LocationFree Up TypeTransfer LocationTransfer Location
Offshore SiteTransfer LocationOffshore SiteOffshore Site
Offshore QtyOffshore SiteOffshore QtyOffshore Qty
Offshore Monthly Cost InOffshore QtyOffshore Monthly Cost InOffshore Monthly Cost In
Offshore Monthly Cost OutOffshore Monthly Cost InOffshore Monthly Cost OutOffshore Monthly Cost Out
Rev MonthlyOffshore Monthly Cost OutRev MonthlyRev Monthly
PM MonthlyRev MonthlyPM MonthlyPM Monthly
GM MonthlyPM MonthlyGM MonthlyGM Monthly
Contract IdGM MonthlyContract IdContract Id
Rev/Cost P&L CatContract IdRev/Cost P&L CatRev/Cost P&L Cat
Customer/AccountRev/Cost P&L CatCustomer/AccountCustomer/Account
Customer CodeCustomer/AccountCustomer CodeCustomer Code
RED AccountCustomer CodeRED AccountRED Account
Customer  Assigment [%]RED AccountCustomer  Assigment [%]Customer  Assigment [%]
SupplierCustomer  Assigment [%]SupplierSupplier
Ariba IdSupplierAriba IdAriba Id
IndustryAriba IdIndustryIndustry
Local InitiativeIndustryLocal InitiativeLocal Initiative
Local FlaggingLocal InitiativeLocal FlaggingLocal Flagging
CommentsLocal FlaggingCommentsComments
Degree of ImplementationDegree of ImplementationDegree of ImplementationDegree of Implementation
Action DescriptionAction DescriptionAction DescriptionAction Description
CurrencyCurrencyCurrencyCurrency
Jan A (Sav)Jan A (Sav)Jan A (Sav)Jan A (Sav)
Feb A (Sav)Feb A (Sav)Feb A (Sav)Feb A (Sav)
Mar A (Sav)Mar A (Sav)Mar A (Sav)Mar A (Sav)
Apr A (Sav)Apr A (Sav)Apr A (Sav)Apr A (Sav)
May A (Sav)May A (Sav)May A (Sav)May A (Sav)
Jun A (Sav)Jun A (Sav)Jun A (Sav)Jun A (Sav)
Jul A (Sav)Jul A (Sav)Jul A (Sav)Jul A (Sav)
Aug A (Sav)Aug A (Sav)Aug A (Sav)Aug A (Sav)
Sep E (Sav)Sep A (Sav)Sep A (Sav)Sep A (Sav)
Oct E (Sav)Oct E (Sav)Oct A (Sav)Oct E (Sav)
Nov E (Sav)Nov E (Sav)Nov E (Sav)Nov E (Sav)
Dec E (Sav)Dec E (Sav)Dec E (Sav)Dec E (Sav)
 (Sav)Sep A -Sep E (Sav)Oct A - Oct E (Sav)Sep A -Sep E (Sav)
Q1 (Sav)Q1 (Sav)Q1 (Sav)Q1 (Sav)
Q2 (Sav)Q2 (Sav)Q2 (Sav)Q2 (Sav)
Q3 (Sav)Q3 (Sav)Q3 (Sav)Q3 (Sav)
Q4 (Sav)Q4 (Sav)Q4 (Sav)Q4 (Sav)
H1 (Sav)H1 (Sav)H1 (Sav)H1 (Sav)
H2 (Sav)H2 (Sav)H2 (Sav)H2 (Sav)
FY Total (Sav)FY Total (Sav)FY Total (Sav)FY Total (Sav)
YTD (Sav)YTD (Sav)YTD (Sav)YTD (Sav)
Jan (Sav) WOct (Sav) WNov (Sav) WOct (Sav) W
Feb (Sav) WNov (Sav) WDec (Sav) WNov (Sav) W
Mar (Sav) WDec (Sav) WQ4 (Sav) WDec (Sav) W
Apr (Sav) WQ4 (Sav) WH2 (Sav) WQ4 (Sav) W
May (Sav) WH2 (Sav) WJan A (HC)H2 (Sav) W
Jun (Sav) WJan A (HC)Feb A (HC)Jan A (HC)
Jul (Sav) WFeb A (HC)Mar A (HC)Feb A (HC)
Aug (Sav) WMar A (HC)Apr A (HC)Mar A (HC)
Sep (Sav) WApr A (HC)May A (HC)Apr A (HC)
Oct (Sav) WMay A (HC)Jun A (HC)May A (HC)
Nov (Sav) WJun A (HC)Jul A (HC)Jun A (HC)
Dec (Sav) WJul A (HC)Aug A (HC)Jul A (HC)
Q1 (Sav) WAug A (HC)Sep A (HC)Aug A (HC)
Q2 (Sav) WSep A (HC)Oct A (HC)Sep A (HC)
Q3 (Sav) WOct E (HC)Nov E (HC)Oct E (HC)
Q4 (Sav) WNov E (HC)Dec E (HC)Nov E (HC)
H1 (Sav) WDec E (HC)Oct A - Oct E (HC)Dec E (HC)
H2 (Sav) WSep A -Sep E (HC)Q1 (HC)Sep A -Sep E (HC)
Jan A (HC)Q1 (HC)Q2 (HC)Q1 (HC)
FAb A (HC)Q2 (HC)Q3 (HC)Q2 (HC)
Mar A (HC)Q3 (HC)Q4 (HC)Q3 (HC)
Apr A (HC)Q4 (HC)H1 (HC)Q4 (HC)
May A (HC)H1 (HC)H2 (HC)H1 (HC)
Jun A (HC)H2 (HC)FY (HC)H2 (HC)
Jul A (HC)FY (HC)YTD (HC)FY (HC)
Aug A (HC)YTD (HC)Item #YTD (HC)
Sep E (HC)Item #Rally IdItem #
Oct E (HC)Rally IdDeployment IDRally Id
Nov E (HC)Deployment IDLast Update UserDeployment ID
Dec E (HC)Last Update UserProject IdLast Update User
 (HC)Project IdIn OutlookProject Id
Q1 (HC)In OutlookAcquisitionIn Outlook
Q2 (HC)Acquisition Acquisition
Q3 (HC)   
Q4 (HC)   
H1 (HC)   
H2 (HC)   
FY (HC)   
YTD (HC)   
Item #   
Rally Id   
Deployment ID   
Last Update User   
Project Id   
In Outlook   
Acquisition   

Hi @darylmitchell ,

 

When I asked for your full M query, I meant the M code from Advanced Editor in Desktop. Sorry, I should have been clearer with what I needed.

 

Also, exactly what error are you getting when you try to refresh in the Service? I'm assuming you're getting your Excel data from SharePoint or Azure, or that you've got an Enterprise Gateway set up?

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




The data is coming from Onedrive for business and is in xlsx format.

This is what was failing when a column isn't available.
But as you will see I do not references any columns specifically.

let
 
  Cache_Action_Line_Item_Details_Sheet = Source{[Item = "Cache_Action_Line_Item_Details", Kind = "Sheet"]}[Data],
  #"Removed Top Rows" = Table.Skip(Cache_Action_Line_Item_Details_Sheet, 24),
  #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars = true]),
  Custom = Table.TransformColumnTypes(#"Promoted Headers",List.Transform(Table.ColumnNames(#"Promoted Headers"), each {_ , type text})),
  #"Removed Columns" = Table.RemoveColumns(Custom, {"Column1"})
in
  #"Removed Columns"

Type of error I get.   "Error: Expression.Error: The column '(HC)_1' of the table wasn't found. <ccon>(HC)_1</ccon>. RootActivityId = c01c7c64-523a-4106-b63d-27ddfb7ee3ee.Param1 = Expression.Error: The column '(HC)_1' of the table wasn't found. <ccon>(HC)_1</ccon> Request ID: a28ad399-2c04-441b-92e9-34467c386bc7."


 

 

Ok. I can't see the unpivot step that you referenced in your original post in this code. I think this is potentially a key step here as this obviously removes a lot of the column name values issue as they become row values instead. Just make sure to use 'Unpivot OTHER Columns' after selecting known and non-changing columns first.

 

Another option might be to create a dummy table that just contains all variations of the changeable column names with empty values. You then append this dummy onto your actual data as soon as it comes in and it will give you a table with all possible column names, allowing hard-referenced transformations to always work. Not ideal, but an option.

 

Beyond this, I think I'd need to see an example of anonymised raw data and an example of your expected output to really be able to put together a bespoke solution.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




I see the days have different columns. Make sure your code isn't naming specific columns to unpivot, if it is add a dummy column and use "unpivot other columns".

I have tried the unpivot.
But it fails reading the inital data, before I get to the step to unpivot.
This only hapopend when I move a pibx to Enterprise, not when I run locally on desktop.

 

In that case try this: In desktop Power Query, click the little square between the column and row headers and select "keep errors". Sometimes Desktop can handle individual cell errors in a way Service can't.

"kept errors" seems to remove the rows that are erroring,  which because it is a column issue it relates to all rows.  So the flow runs but I get no data now.
Thanks for trying.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors