How can we help?

Publishing and auto-refreshing Auvik’s Power BI templates to Power BI Pro and Premium

Follow

If you’d like to publish Auvik’s Power BI templates to Power BI Pro and Premium, you’ll need to remove several parameters. This guide will help you find those parameters and replace them with the appropriate values. 

Identifying the parameters 

The first set of parameters to remove are located in the user input elements you provide when you first create a Power BI report using the Auvik templates.

image8.png

These parameters are used to identify your data in Auvik, and make sure Power BI downloads the data for only the periods that you need. 

  1. Click Transform data to access the Power Query editor, where you'll find the parameters.

image5.png

  1. Find the following four parameters, which you’ll need to delete:
    • Auvik Server Cluster
    • Domain Prefix of Main Client
    • Report Start Date
    • Report End Date

image7.png

  1. Right-click to delete each parameter. You’ll get a warning prompt letting you know which queries use that parameter.

image1.png

  1. Note down in which query each parameter is used. This will help you find where each parameter is being used so you can follow the rest of this tutorial.

Before you can delete the parameter, you’ll need to use the advanced editor to edit each query where a parameter is being used, replacing the parameter with the appropriate code.  

The sections below explain how each parameter should be replaced. 

Server Cluster parameter

  1. For each query using the Server Cluster parameter, right-click to access the advance editor.

image9.png

  1. The part of the code that refers to the server cluster looks like this:
#"Auvik Server Cluster"

image6.png

  1. Replace the code in between the quotation marks with the ID of your regional Auvik server cluster.

You can find the ID of your regional Auvik server cluster by looking at the URL from your Auvik account. The cluster ID is the data between your domain prefix and my.auvik. For example, in this URL, the server cluster ID is  us1: https://myaccount.us1.my.auvik.com/

A successfully replaced line of code will look like this:

Original:

UrlPrefix = "https://auvikapi." & #"Auvik Server Cluster" & ".my.auvik.com/v1/alert/history/info?filter[detectedTimeAfter]=",

Updated:

UrlPrefix = "https://auvikapi." & "us2" & ".my.auvik.com/v1/alert/history/info?filter[detectedTimeAfter]=",
  1. To make sure your change has been successful, click Refresh Preview and make sure you’re able to download data.

image2.png

Repeat the process for all queries that use the Server Cluster parameter. You can confirm you’ve successfully updated all of them by trying to delete the Server Cluster parameter from the queries list. If you’ve removed the parameter from all queries, Power BI will now allow the deletion. 

Domain Prefix parameter

The Domain Prefix parameter is used, at the time of this article, exclusively on the Client/Sites Details query (not in the Client/Sites or in any other query).

  1. Open the advanced editor in the Client/Sites Details query by right-clicking and selecting Advanced Editor.
  2. The part of the code that refers to the domain prefix looks like this:
#"Domain Prefix of Main Client"


image4.png

  1. Replace the code in between the quotation marks with the domain prefix for your top-level multi-site Auvik account.

    You can find your domain prefix by looking at the URL from your Auvik account. It’s the data just after the https:// header. For example, in this URL the domain prefix is myaccounthttps://myaccount.us1.my.auvik.com/

  2. A successfully replaced line of code will look like this:

Original:

Source = Json.Document(Web.Contents("https://auvikapi." & #"Auvik Server Cluster" & ".my.auvik.com/v1/tenants/detail?tenantDomainPrefix=" & #"Domain Prefix of Main Client" )),

Updated:

Source = Json.Document(Web.Contents("https://auvikapi." & #"Auvik Server Cluster" & ".my.auvik.com/v1/tenants/detail?tenantDomainPrefix=" & "myaccount" )),
  1. To make sure your change has been successful, click Refresh Preview and make sure you’re able to download data.
    image2.png

The Client/Sites details query is the only one using the Domain Prefix parameter, so once you’ve made this single change, you can safely delete the parameter from the query list. 

Date period parameters

There are two parameters used to define the period of a report: Report Start Date and Report End Date. The date parameters need to be replaced by date-calculating logic in Power BI that will run every time the report is auto-refreshed. 

The output of the logic should always be two dates, the start date and end date for the report, both formatted in YYYY-MM-DD.

  1. For each query using the date parameters, right-click to access the advanced editor.  In this example, we’ll be using code from the Device Bandwidth query. 
  2. The part of the code that refers to the report dates looks like this:
#"Report Start Date"
#"Report End Date"

image3.png

  1. Replace the code in between the quotation marks with date-calculating logic based on the reporting period you want to include in the report. You might need to do some research on how Power Query manages dates. Our sample code provides a starting reference.

Original:

startDate= #"Report Start Date",
endDate = #"Report End Date",

Updated:

startDate= Date.From(Date.StartOfMonth(Date.AddMonths(DateTime.LocalNow(),-1))), 
endDate = Date.From(DateTime.LocalNow()),

Note 1:
The calculation above creates a reporting period from one month ago to today. This means that every time the report is refreshed, you’ll see the last month of data from today’s date. Consult Microsoft Power BI’s documentation to find the appropriate date logic for your particular needs.
Note 2:
The final date passed to Auvik’s APIs should always be in YYYY-MM-DD format. Be mindful of this when working with dates. You can read more on the implementation details in Auvik’s API documentation.

  1. To make sure your change has been successful, click Refresh Preview and make sure you’re able to download data.

Repeat the process for all queries that use the Date Period parameters. You can confirm you’ve successfully updated all of them by trying to delete the date period parameters from the queries list. If you’ve removed the parameter from all queries, Power BI will now allow the deletion.

Publishing to Power BI Pro or Premium

Once all parameters are removed and replaced by static data or logic, you should be able to publish the report to the different tiers of Power BI cloud offerings. 

One additional item you may want to consider is creating site-specific versions of the reports, so each site or group of sites has a different report you can share with different groups of users. For details, see Creating a Power BI report for specific sites.

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request