Using API for Analytics and Visualizations
This article explains how to extract data from an IMS View into Power BI, using the Export to Excel API that is available for views.
Step 1 - IMS View
- Create a view in IMS that has the columns and filters that contain the data you want to make available in Power BI:
- The view will have its own URL:
http://<servername>:9877/C7IMS/#/bu-1/inventory/viewgroup-1/view-1
- The URL will have three unique identifiers:
- Business Unit (bu-1)
- View Group (viewgroup-1)
- View (view-1)
Step 2 - Power BI Report
- Create a new report in Power BI
- Click on Transform data > Transform data
- Click on Manage Parameters:
- Create four parameters:
Name | Description | Required | Type | Suggested Values | Current Value (examples) |
SiteUrl | Copy the value from the url which states the server name | Yes | Text | Any value | http://<servername>:9877/ |
BusinessUnitID | Copy the value from the url which states bu-<number> | Yes | Text | Any value | 1 |
ViewGroupId | Copy the value from the url which states viewgroup-<number> | Yes | Text | Any value | 1 |
ViewId | Copy the id from the number in the url where it states view-<number> | Yes | Text | Any value | 1 |
Note that the Name is case-sensitive.
- Click on Enter Data:
- Enter an appropriate name (e.g. ViewRecords)
- Select ViewRecords from the Queries list and click on Advanced Editor:
- Remove any existing text and replace it with:
let Source = Excel.Workbook(Web.Contents(#"SiteUrl" & "C7IMS/api/businessunits/" & #"BusinessUnitID" & "/viewGroups/" & #"ViewGroupId" &"/views/" & #"ViewId" & "/exportContent?filterXml=&token="), null, true), records = Source{[Item="Table1",Kind="Table"]}[Data],
#"Changed Type" = records
in #"Changed Type"
- Click on Done
- The records from the IMS view will be listed in the ViewRecords table:
- Click on Close & Apply:
You can now start to build visuals with the data based on your requirements:
Note: here is an example Power BI report for reference:
Note: the Power BI report can be copied and updated for each different view that you want to pull data from.