Anaplan Connector
Power BI is a powerful tool for data analysis and visualization, and one of its strengths is its ability to connect to a wide variety of data sources. One of these data sources is Anaplan, a cloud-based business planning and performance management platform. In this article, we will explore how to use Power Query M Language code to connect to the Anaplan Connector data source from inside Power BI.
What is Anaplan?
Anaplan is a cloud-based platform that enables businesses to plan, model, and analyze their data in real-time. It provides a single source of truth for all data related to business operations, making it easy to collaborate and make informed decisions. Anaplan offers a variety of connectors to integrate with other systems, including Salesforce, NetSuite, and SAP.
What is Power Query M Language?
Power Query M Language is the programming language used by Power Query to transform and manipulate data. It is a functional language that allows users to create complex transformations and calculations with ease. Power Query M Language code can be used to connect to a wide variety of data sources, including Anaplan.
Connecting to the Anaplan Connector Data Source
To connect to the Anaplan Connector data source from inside Power BI, we will need to follow these steps:
1. Open Power BI and go to the Home tab.
2. Click on Get Data and select Anaplan from the list of available data sources.
3. In the Anaplan Connector dialog box, enter your Anaplan credentials and click Connect.
4. Once connected, you will see a list of available Anaplan workspaces. Select the workspace you want to connect to and click OK.
5. You will now see a list of available modules in the selected workspace. Select the module you want to import and click Load.
6. Power Query will now import the data from the selected module into Power BI. You can now use this data to create reports and visualizations.
Using Power Query M Language Code to Connect to Anaplan
While the above steps are relatively straightforward, they can be time-consuming if you need to connect to Anaplan on a regular basis. Fortunately, Power Query M Language code can be used to automate this process and make it more efficient.
To connect to Anaplan using Power Query M Language code, we will need to define a function that includes the necessary connection parameters. Here is an example of what this might look like:
let
url = “https://api.anaplan.com/2/0/workspaces/{workspaceId}/models/{modelId}/tasks”,
headers = [
#”Authorization”=”AnaplanAuthToken {authToken}”,
#”Content-Type”=”application/json”
],
body = “{“”locale””:””en_US””,””taskName””:””import””,””parameters””:{
“”Id””:””{moduleId}””,””New””:””true””,””Revision””:””{revisionId}””}}”
in
Web.Contents(url, [
Headers = headers,
Content = Text.ToBinary(body)
])
This code defines a function that connects to the Anaplan API and imports data from a specified module. To use this code in Power BI, follow these steps:
1. Go to the Home tab in Power BI and click on Transform Data.
2. In the Power Query Editor, click on View and select Advanced Editor.
3. Paste the code into the editor and replace the placeholders (workspaceId, modelId, authToken, moduleId, and revisionId) with the appropriate values.
4. Click Done and then Close & Apply.
5. Power Query will now execute the function and import the data into Power BI.
Conclusion
In this article, we have explored how to connect to the Anaplan Connector data source from inside Power BI using both the graphical user interface and Power Query M Language code. By using Power Query M Language code, we can automate the process and make it more efficient, saving time and effort. With the ability to connect to a wide variety of data sources, including Anaplan, Power BI is a powerful tool for data analysis and visualization.