Power BI and Dynamics CRM

Dynamics CRM and Power BI

Microsoft is building lots of cloud based technologies these days and Microsoft Dynamics CRM is not an exception. With a powerful data visualisation tool like Power BI Microsoft took a great step to integrate Dynamics CRM and Power BI which means you can easily connect from Power BI website and Power BI Desktop to a cloud based Microsoft Dynamics CRM instance. In this article I express a step-by-step tutorial to be able to connect to connect to Dynamics CRM from Power BI website as well as Power BI Desktop.

Prerequisites:

  • You can only connect to Dynamics CRM Online (Cloud based Dynamics CRM) from both Power BI Desktop and Power BI website. If you have an older version on-premises Dynamics CRM and you’re willing to create visualisations on Power BI then you need to connect to the CRM database on SQL Server instance just like any other SQL Server databases.
  • You need to have a valid OData URL for a Dynamics CRM Online instance and an administrator must enable the OData endpoint in the CRM site settings. To find the OData endpoint address:
      • After browsing your CRM Online in a browser click “Customizations” from “Settings”

      • Click “Developer Resources”

      • Scroll down and then you can see OData URL under “Organization Data Service”

  • You should connect to Dynamics CRM Online using the same user account as your Power BI website. So if you have a different Power BI account then unfortunately you need to create a new account in Power BI which is identical to your CRM account.
  • Your browser’s popup blocker should be disabled or you should exclude https://login.microsoftonline.com from your popup blocker.
  • As Microsoft Dynamics CRM is integrated with Power BI you need to have Office 365 subscription. If you don’t have Dynamics CRM Online and Office 365 subscription, but, you’re willing to learn how Power BI and Dynamics CRM Online work together you can sign up for a 30-day trial of Microsoft Dynamics CRM here. There is also a trial guide for Microsoft Dynamics CRM Online and Office 365 here.

Power BI Website and Dynamics CRM:

Get Data:

  • Browse and sign in to Power BI website from a browser
  • Click “Get Data”
  • From “Content Pack Library” click “Services”

  • Click “Microsoft Dynamics CRM” then click “Connect”

  • If you get the “Parameter validation failed, please make sure all parameters are valid.” error message then you probably forgot to remove the forward slash (/) from the OData URL.

The OData should be something like this:

https://[tenant].crm5.dynamics.com/XRMServices/2011/OrganizationData.svc

rather than

https://[tenant].crm5.dynamics.com/XRMServices/2011/OrganizationData.svc/

  • Select “oAuth2” from “Authentication Method” drop down list then click “Sign In”

  • Now you’re connecting to Office 365. Sign in to your office 365 account and click on “Work or school account”. Remember, you should use the same user account as your Dynamics CRM Online account here.

NOTE: Your popup blocker should be disabled.

  • Sign in to your Office 365 account
  • Voila! You can see a predesigned dashboard ready to use in your Power BI website.

Schedule Refresh:

  • Find the Dynamics CRM in “Datasets” pane then click “Open Menu” ellipsis

  • Expand “Data Source Credentials” and “Schedule Refresh” and setup the desired schedule

Power BI Desktop and Dynamics CRM:

Get Data:

  • Open Power BI Desktop
  • Search for “CRM” to easily find the connector then click connect

  • Past the OData URL you copied before
  • Remember to remove the last forward slash from the end of the URL
  • Click OK

  • You can search the tables and select those ones you need then click “Load”

  • Now you can create your visualisations. I’m not going to explain how to do that as it had been covered here.
  • Publish the visualisation to Power BI website by clicking on the “Publish” button from the ribbon bar

Schedule Refresh:

  • From Power BI website find your newly published dataset from “Datasets” pane
  • Click “Open Menu” ellipsis

  • Click “Schedule Refresh”
  • Click “Edit Credentials” under “Data Source Credentials”
  • Select “oAuth2” from “Authentication Method” drop down then “Sign In”

  • Connect to Office 365 using your credentials
  • Expand “Schedule Refresh” and setup the desired schedule

All done!