Automated Reports

## Team Members

* Iyinfoluwa Oni
* Alvin Pham
* Alberto Briseno Martinez
* James Burbach

## Automated Reporting in Power BI

### Introduction

Microsoft Power BI is an interactive data visualization software solution with a primary focus on business intelligence. It's a component of the Microsoft Power Platform. You may use Power Automate to automate the exporting and distribution of Power BI reports in a range of formats and scenarios. This post will walk you through the process of creating your own flow from start to finish on automation reports. It will also highlight how you can use the Relative Date filter and slicer when creating automated reports.

## Prerequisites to Create Automated Reports

### Get your data ready

The first step is to have the data you plan to use already prepared and stored where it can be accessed by the Power BI application. There are various places where Power BI can pull data from, such as Excel files, CSV or Text files, SQL Servers, and so on. It's also worth noting that you can combine various datasets together. Below are various ways of getting data:

### Connecting to a Data Source

Due to the version of PowerBI that we are currently running, we do not have the capability to connect to a certain databases. But if you had the ability to, you would click on the **Database** tab within **Get Data** and select the database that you wish to use.

The reason why we may want to connect to a database is because we will be able to have dynamic data. Files such as excel sheets and CSVs are categorized as "static data sets", meaning that they will not change unless the file is directly edited. With dynamic data sources, the data can change and update if more data is added to a database.

### Storage Modes

When working with live data sources in Power BI, there are several different modes of storage.

* *Import Mode*
	+ It queries the database and creates a data set. To refresh the data you must do it manually. It can be very memory intensive with larger data sets.
* *DirectQuery and LiveConnect Mode*
	+ The dataset is not imported from the database but requested directly from the database.
* *Push Mode*
	+ Pushes the data to Power BI via an external service or process.

**DirectQuery Mode** and **LiveConnect Mode** will directly query the data source. When using Import Mode, Power BI will import the data from the database into your dataset, which will update your visualizations.

### Dataset Scheduled Refresh

Import Mode requires that the user set a scheduled refresh to update the dataset. This can be any frequency of time. For instance, daily at 1:00PM.

To schedule a refresh, in the navigation pane under **Datasets** -> Select **More Options** -> Select **Schedule refresh** -> Select the **Trip Dot at the bottom**

Now ensure that **Keep your data up to date slider** is set to **On** and **Send refresh failure notification emails to me** is checked. Then configure your **Refresh Frequency, Time Zone, and Time** are configured. Optionally, you may add multiple times by selecting **Add another time**.

These settings will ensure that your dataset will be refreshed with the data sources' new data, and if it fails, it will send the user an email explaining why it failed. If you wish to test to ensure that the data source will refresh, go to the **Dataset Menu** and click **Refresh Now**. Refreshes may not occur at the exact time that you schedule them but they should occur within 15 minutes of the set time.

## How to Create an Automated Report

You can automate any report in Power BI by using Relative Date Filters or Slicers and DAX (although only in special cases for specific date intervals). A relative date filter or slicer allows users to select a period of time relative to a date (usually the current date) to show only data contained in that period. This allows for reports and visuals to automatically show the desired data even when the underlying sources are updated. For example, if a relative date filter of current month is applied to a report, it will show November data as soon as the current date is November 1st; consequently, it will populate later months as soon as they are updated in the underlying data source and the current date falls in that month.

Although Relative Date Filter and Relative Date Slicer complete the same filtering function, there are two main differences between them. First, the scope of the slicer is only applied to the selected visuals on a given report page, while traditional filters can be applied to all pages in a report. Second, the slicer visualization offers more flexibility by allowing you to place the filtering option in a different position in the dashboard other than the filter pane.

NOTE: There are different filter levels, and they have an order hierarchy. Takes this into consideration when creating relative date filters.

### How to Create a Relative Date Filter

To create a Relative Date Filter follow the next steps:

Step 1: Drag the desired date field to the Filter pane-level of your choice (all pages, this page, or visual).

Step 2: Click the Filter Type dropdown and select Relative Date.

Step 3: Define the date period.

You have the following options for the relative date:

Step 4: Verify period.

Once the date range has been applied, the specific range of time selected will be displayed at the top left corner of the filter’s pane.

### How to Create a Relative Date Slicer

To create a Relative Date Slicer, follow the next steps:

Step 1: Create a slicer visual and drag the desired date field to the field value.

Step 2: Select Relative Date for the Slicer type.

Step 3: Define the date period.

Step 4: Verify period.

Once the date range has been applied, the specific range of time selected will be displayed at the slicer's bottom left corner.

### Helpful Tips to Note when Reporting

* Always check the interactions of the various filters to ensure that proper changes are made when the dataset is updated.
* Make sure to consider the aesthetics of the report to reflect the organization you are representing.
* Be sure to always confirm the time zone the report was created in.
* Confirm that you have the licensed version of Power BI in order to create automated reports.

## Conclusion

In summary, the primary function of Power BI is that we are able to create a report once based upon dynamic data, which can give us current information that can be used for analysis or influencing business decisions. You could spend hours, if not days, getting a report to look and convey information to users. Automated reports help in the distribution of this information with little manual intervention from the end user and report creators.