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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Malfi
New Member

Issue with Promoting Headers in Power Query (Exchange Connector)

Hello Everyone,

I’m currently receiving data by email every day, and I use the Microsoft Exchange connector in Power BI (via Power Query) to pull this data for my analysis.

The issue I’m facing is with promoting headers. When I invoke my function, most of the columns end up with a row offset, leaving a gap before the actual data. I’ve tried using the Promote Headers function, but since the “Date Time Received” value changes every day, it causes errors during refresh.

Has anyone encountered this before? Do you have a simple way to handle this so that the headers are promoted correctly each time, regardless of the daily variation?

Thanks in advance for your help!



Malfi_0-1755506619856.png

 

1 ACCEPTED SOLUTION
jaineshp
Memorable Member
Memorable Member

Hey @Malfi,

I've dealt with this exact issue before. The changing DateTime values definitely mess up the header promotion. Here's what worked for me:

Solution:

  • Skip rows dynamically first - Use Table.Skip(YourTable, 1) or Table.Skip(YourTable, 2) before promoting headers. This bypasses the DateTime row that's causing the offset.
  • Find header row programmatically - Add this step to locate your actual data headers:
    = Table.Skip(Source, List.PositionOf(Table.Column(Source, "Column1"), "YourExpectedHeaderName"))
  • Use Table.PromoteHeaders after the skip - Once you've skipped past the DateTime rows, the promotion should work consistently.

This eliminates the DateTime dependency completely. I've been using this approach for months with daily email refreshes and haven't had issues since.

 

The key is identifying the consistent row position of your headers relative to the email structure, not the DateTime values.

 

Fixed? ✓ Mark it • Share it • Help others!


Best Regards,
Jainesh Poojara | Power BI Developer

View solution in original post

5 REPLIES 5
dufoq3
Super User
Super User

Hi @Malfi, another solution with dynamic rename:

Before

dufoq3_0-1755772980154.png

 

After

dufoq3_1-1755772992729.png

let
    Source = Expression.Evaluate("Table.FromRows(List.Transform(Text.Split(""1-Jun-28;1-Jul-28;8/18/2025 7:01:05 AM|0;0;8/18/2025 7:01:05 AM|0;0;8/18/2025 7:01:05 AM"",""|""), each Text.Split(_, "";"")), {""Column73"",""Column74"",""DateTimeReceived""})", #shared),
    PromotedHeaders = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    DynamicRename = Table.RenameColumns(PromotedHeaders,{{Table.ColumnNames(PromotedHeaders){List.PositionOf(Table.ColumnNames(Source), "DateTimeReceived")}, "DateTimeReceived"}})
in
    DynamicRename

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

v-lgarikapat
Community Support
Community Support

Hi @Malfi ,

Thank you for reaching out to the Microsoft fabric community forum.

@ChielFaber , @jaineshp 

Thanks for your prompt response

@Malfi , 

I wanted to follow up and confirm whether you’ve had the opportunity to review the information   provided by @ChielFaber , @jaineshp  Should you have any questions or require further clarification, please don't hesitate to reach out.

We appreciate your engagement and thank you for being an active part of the community.

Best Regards,

Lakshmi.

ChielFaber
Solution Specialist
Solution Specialist

ChielFaber_0-1755511386516.png
If I'm reading your question right the problem is as depicted in the picture above (where column 73, 74 are most likely blank?)

With the above dummy data I managed to get it to work using the following script:

let
// Replace 'Bron' with your actual table step
Bron = bron,

// 1) Extract the first 2 rows (these contain the header candidates)
HeaderRows = Table.FirstN(Bron, 2),

// 2) Row 1 and Row 2 as records
R1Rec = HeaderRows{0},
R2Rec = HeaderRows{1},

// 3) Convert both records to lists so we can access values by index
R1 = Record.ToList(R1Rec),
R2 = Record.ToList(R2Rec),

// 4) Build the new header list:
// - First column: row 2 value
// - Second column: row 2 value
// - Third column: row 1 value
NewHeadersRaw = { R2{0}, R2{1}, R1{2} },
NewHeaders = List.Transform(NewHeadersRaw, each Text.From(_)),

// 5) Get the data rows (skip the first 2 header rows)
DataRows = Table.Skip(Bron, 2),

// 6) Rename the data table’s columns with the new header list
Result = Table.RenameColumns(
DataRows,
List.Zip({ Table.ColumnNames(DataRows), NewHeaders }),
MissingField.Ignore
)
in
Result

 

the output:

ChielFaber_2-1755511535723.png

Could you check if this is working for you?


Regards,


Chiel


[Tip] Keep CALM and DAX on.
[Solved?] Hit “Accept as Solution” and leave a Kudos.
[About] Chiel | SuperUser (2023–2) |
jaineshp
Memorable Member
Memorable Member

Hey @Malfi,

I've dealt with this exact issue before. The changing DateTime values definitely mess up the header promotion. Here's what worked for me:

Solution:

  • Skip rows dynamically first - Use Table.Skip(YourTable, 1) or Table.Skip(YourTable, 2) before promoting headers. This bypasses the DateTime row that's causing the offset.
  • Find header row programmatically - Add this step to locate your actual data headers:
    = Table.Skip(Source, List.PositionOf(Table.Column(Source, "Column1"), "YourExpectedHeaderName"))
  • Use Table.PromoteHeaders after the skip - Once you've skipped past the DateTime rows, the promotion should work consistently.

This eliminates the DateTime dependency completely. I've been using this approach for months with daily email refreshes and haven't had issues since.

 

The key is identifying the consistent row position of your headers relative to the email structure, not the DateTime values.

 

Fixed? ✓ Mark it • Share it • Help others!


Best Regards,
Jainesh Poojara | Power BI Developer

Hey @jaineshp 

Thanks a lot It worked perfectly 🙂

@ChielFaber  Thanks a lot for your answer.

Best Malfi

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.