Forum Discussion
Batman020
10 months agoNew Member
Data Format Error in Powerbi Service
I am Getting the Following Error while refreshng in powerBi service . I have a bunch of file all are coming from the sharepoint folders.But from where can i check this error it doesnot state the docu...
- 9 months ago
Hi Batman020,
If you're using Excel files and not XML files, there is no need to do any XML parsing. Use the Excel file connector, or the Web or SharePoint Folder connectors to connect and parse the Excel file directly.
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
djurecic
10 months agoSuper User
Hi Batman020 ,
The error "Power BI Reference to undeclared entity 'ndash'" indicates that the XML data you are attempting to load into Power BI contains an HTML entity, specifically
– (en dash), which is not a pre-defined entity in XML.
Explanation:
-
XML vs. HTML Entities:While HTML defines many named entities like –, , ©, etc., XML only predefines a limited set of entities: <, >, &, ', and ". Any other named entity in an XML document must be explicitly declared within a Document Type Definition (DTD) or replaced with its numerical character reference.
-
Power BI and XML:
When Power BI attempts to parse XML data, it expects well-formed XML. If it encounters a named entity like – that is not declared or is not one of the five predefined XML entities, it throws an "undeclared entity" error.
Solutions:-
Modify the Source XML:
- Replace with the actual character: The most straightforward solution is to replace
– with the actual en dash character (–) in the source XML data. - Use the numerical character reference: Alternatively, replace
– with its numerical character reference, which is– (hexadecimal) or– (decimal). -
Declare the Entity in a DTD (More Complex):
- If you have control over the XML generation and need to use named entities, you can declare them in a DTD associated with the XML file. This approach is generally more involved and might not be feasible if you are consuming external XML feeds.
-
Pre-process the XML data (if direct source modification is not possible):
- If you cannot modify the source XML, you might need to pre-process the data before loading it into Power BI. This could involve using a scripting language (like Python) to read the XML, replace the problematic entities, and then save the corrected XML for Power BI to consume.
Example of replacing in M (Power Query):If the data is loaded into Power Query, you could add a step to replace the entity:Code
= Table.ReplaceValue(Source, "–", "–", Replacer.ReplaceText, {"YourColumnName"})Replace"YourColumnName" with the actual name of the column containing the XML data or the text with the– entity.This answer was partially generated by AI
- If you cannot modify the source XML, you might need to pre-process the data before loading it into Power BI. This could involve using a scripting language (like Python) to read the XML, replace the problematic entities, and then save the corrected XML for Power BI to consume.
- Replace with the actual character: The most straightforward solution is to replace
-