Forum Discussion
Jacb
1 year agoFrequent Visitor
How to deal with multiple headers in data in Power BI
Hi, I am trying to read in the data from PDF document that contains operational stats. The data from the PDF file looks like this. When the PDF file is read into Power BI - Power BI iden...
- 1 year ago
Use this
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]), #"Filtered Rows" = Table.SelectRows(#"Promoted Headers", each [Log In] <> null), #"Added Agent Id" = Table.AddColumn(#"Filtered Rows", "Agent Id", each if Text.StartsWith(Text.From([Log In]),"Agent Id",Comparer.OrdinalIgnoreCase) then [Log Out] else null), #"Added Agent Name" = Table.AddColumn(#"Added Agent Id", "Agent Name", each if Text.StartsWith(Text.From([Log In]),"Agent Name",Comparer.OrdinalIgnoreCase) then [Log Out] else null), #"Added Date" = Table.AddColumn(#"Added Agent Name", "Date", each if [Log Out] = null then [Log In] else null), #"Filled Down" = Table.FillDown(#"Added Date",{"Agent Id", "Agent Name", "Date"}), #"Filtered Data Rows Only" = Table.SelectRows(#"Filled Down", each [Log In] <> "Agent Id:"and [Log In] <> "Agent Name:"and [Log Out] <> null), #"Reordered Columns" = Table.ReorderColumns(#"Filtered Data Rows Only",{"Agent Id", "Agent Name", "Date", "Log In", "Log Out", "Login", "Available T", "Released T", "Available", "Released", "In Call T", "Media Type", "Calls", "Avg T To", "Max T To"}) in #"Reordered Columns"to produce this:
from this Excel Data:
Omid_Motamedise
Super User
1 year agoThis is exactly the awnser of your question
https://youtu.be/pofthD7-YuQ?si=rh_pW-ZYYlxhBo--
- Jacb1 year agoFrequent Visitor
Thank you for your link to your video.
Your video helped me to understand the methodology. My source was not an originally table though as it was table contain pages and tables but I still understood your methodology and how it worked.
Thanks again for all your help
JB