Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

(Draft in Progress)

Microsoft Power BI is a business analytics platform that provides interactive data visualizations for business intelligence (BI). You can use Microsoft Power BI to build customized reports or combine the data it provides with data from other tools to build a unified dashboard.

You can use the License Statistics API as input to Power BI; for example, to create a custom report. The steps to use the License Statistics API with Power BI include: 

  1. Create a token with API scope in License Statistics.  
  2. Add a Web data source to Power BI.
  3. Prepare the License Statistics API data Create a reportfor use with Power BI.
  4. Use the prepared License Statistics data to create a Power BI report.

These steps are detailed below.

Anchor
create
create
Create a token with API scope

...

In order to make API requests, you must use a token, as described in detail in Making an API request.

  1. Go to API under your logged in username, shown in the upper right corner of the application window.
  2. Click Add to create a new API token.
  3. From the dialog that opens, choose API as the scope type for the token.

    Image Added

  4. Optionally, add a description to identify the token.
  5. Click Save to create the token.

After you save your new API token, you'll see it

Image Removed

Save the new API token. It will appear in the API Tokens grid.Image Removed

Image Added

Anchor
add
add
Add a Web Data Source to Power BI

In the Power BI Desktop, create :

...

  1. Create a new report

...

  1. .
  2. From the "Get data" menu, select Web as the data source.

    Image Added


  1. Complete the form that displays.

...



  1. Image Added

    1. Toggle the form to Advanced.
    2. Add the API endpoints (URL parts) and click Add part to see the URL preview. The example above uses the endpoint "/api/v2/feature/

...

    1. ID/usage-history/json

...

    1. ," where the ID variable (set to 60 in our example) can be

...

    1. retrieved by using the "/api/v2/feature/list"

...

    1. endpoint or from the Feature ID column in any License Statistics

...

    1. grid, as shown in the illustration below. (The Feature ID column

...

    1. is hidden by default

...

    1. , so you may need to toggle its visibility on.)

      Image Modified

    2. Set the query parameters

...

    1. . For our example,

...

    1. we set a start date of December 6, 2022, and an end date of December 11, 2022, using the following parameters (see API endpoints for a complete list of API endpoint parameters):
      1. sd=2022-12-06
      2. ed=2022-12-11
      3. granularity=DAY

...



      1. Image Added

    1. At the bottom of the form, add

For a complete list of optional API endpoint parameters see API endpoints.

Image Removed

...

    1. the appropriate HTTP request headers; for our example:

      1. Accept: */*
      2. X-Auth-token: {API token value}

...


    1. Click OK to accept the completed form. 

  1. When

...

  1. prompted, use the Anonymous access option. Authorization has

...

  1. been handled by the token we added to the header in the previous step.

...


  1. Image Added

  2. Click Connect to access the defined Web source and get the requested data, which appears as shown below.

    Image Added

Anchor
prepare
prepare
Prepare the data

The data that Power BI receives from the License Statistics API must be formatted before you can read it. Image Removed

  1. Click List to navigate to the data key details.  

...


  1. Image Added

  2. Convert the list of records to a table using the "To Table"

...

  1. option.

...


  1. Image Added

  2. The results appear as shown below.

...


  1. Image Added

  2. The resulting Table of records can be expanded to include multiple columns. Select the fields

...

  1. you want to include in your report from the response. (Note: You can also set a list of returned columns using the fieldsVisibility request parameter.)

    Image Added

    For our example, we

...

  1. selected the following fields:
    1. lud (date)

    2. lumin (min used)

    3. lumax (max used)

    4. ft (total)

Note: You can also set a list of returned columns using the fieldsVisibility request parameter.

Image Removed


  1. Click OK after you've selected the desired fields. The table will be expanded to a multi-column view.

    Image Modified

    Note: See API endpoints for a full list of parameters along with descriptions.

    Image Modified

  2. For proper processing, define the type of data for each column. In our example, the lud property is a Date type, while the rest of the properties are Whole Numbers.

...


  1. Image Added

  2. Rename the columns so they will be understandable in the reports.

...



  1. Image Added

Anchor
report
report
Create a

...

report in Power BI using the License Statistics data

Once you have prepared the data source, you can use the data to create your custom report; for . For example, you could create a Usage History usage history report for a particular feature presenting minimum, maximum that includes maximum usage, minimum usage, and the total number of licenses used daily during a selected period of time. 

For our example, we created a line chart with a date on the X Axis and, and on the Y Axis, the values from the three data series: Max Used, Min Used, and Total.

Image RemovedImage Added