Problem [Solved] - Out of Memory Exception While Working with Dynamic s 365 CE Data in Power BI

Versions

PowerBI: Version 2.66.5376.2521 32-bit

Power Query (M) Builder for Xrm ToolBox: Version 1.2018.1014.5

Problem:

The following errors are observed in Power BI when 'Close & Apply' is pressed after creating queries using Power Query (M) Builder for Xrm ToolBox.

Error 1:

If no changes have been made to the query the following message is displayed and no data is visible.

Cannot load model

We couldn’t connect to your DirectQuery data source or internal model. Double-check that your server and database names are correct, and that you have permission to access them.

No OLE Error Information found.

Error 2

If no changes have been made to the query the following message is displayed and no data is visible

Something went wrong

Exception of type ‘System.OutOfMemoryException’ was thrown

Solution:

This occurred because my views had fields from related entities in the columns e.g. Account (Parent Company). I removed these and the queries worked fine so I just added additional queries for those related entities and created a relationship between them.

Maybe this is in the instructions of the Power Query (M) Builder tool but if it was I missed it and it took me a while to work it out. It didn't help that I'd just had my machine rebuilt and I was certain it was a memory issue.

Update 01/04/2019:

I’m completely aware that this error could be caused by any number or issues so I’ll just document other fixes I found when it occurred again in this article as updates.

I experienced this error again when trying to update an existing query after it had been merged and other modelling functions has been performed on it.

As the project I was working on didn’t require me to connect to any Office documents (I have the x86 version of Office installed) I managed to get around the error by using the x64 version of Power BI. From now on I will work mostly in the x64 version unless it’s absolutely necessary to use the x86 version.