Project

Power BI Driven VBA Application Development

A comprehensive project to develop a VBA application that integrates with Power BI and supports manual data manipulation, with results presented in an interactive dashboard.

Empty image or helper icon

Power BI Driven VBA Application Development

Description

This project involves utilizing Power BI, Excel, Power Apps, Power Automate, and SharePoint in developing a VBA application. The application will allow for data input from Power BI, manual amendments via user forms, and visualization of processed data in a dashboard format. A variety of skills will be called for such as App Development, Advanced Analytics, Data Modeling, Report Design, and Business Analytics, with languages Excel, VBA, DAX, M (Power Query), and Power BI in use.

Power BI and VBA Conceptual Understanding and Practical Implementation

As a professional data scientist and software engineer, we aim to implement a comprehensive project developing a VBA (Visual Basic for Applications) application that integrates with Power BI. This integration would support manual data manipulation, with results presented in an interactive dashboard.

Environment Setup

You will need the following tools installed on your computer:

Implementation Details

Step 1: Power BI-Excel Integration

Power BI integration with Excel enables users to connect to data stored in Excel workbooks and derive insights right from within Power BI.

Loading Excel Data into Power BI

  1. Open Power BI and click on Home > Get Data > Excel. Navigate to the Excel file, select it, and click Open.
  2. The Navigator window will open, showing all workbooks, worksheets, and tables within the Excel file. Select the required tables/worksheets, and click Load.

Excel data will now be available in Power BI and can be used to create reports and dashboards.

Step 2: Creating a Power BI Report

To implement a report using Power BI:

  1. Click Home > Report.
  2. Drag and drop the fields from the Fields pane to the Report pane.
  3. Choose the visualization type and customize it as per your requirement.

Step 3: Implementing VBA with Excel

Visual Basic for Applications (VBA) is a programming language used by Microsoft Office programs to automate tasks. In our case, we'll use VBA with Excel.

Open Excel and follow the steps:

  1. Press ALT + F11 to open the VBA editor.
  2. From the menu, choose Insert > Module . This creates a new module.
  3. In this new module, you're free to write any VBA code. For instance, we can create a subroutine that adds two numbers.

Here's the simple code:

Sub AddNumbers()
    Dim num1 As Integer
    Dim num2 As Integer
    num1 = 10
    num2 = 20
    MsgBox num1 + num2
End Sub

This code will display the sum of num1 and num2 in a message box when run.

Step 4: Connecting Power BI and VBA

Unfortunately, Power BI does not support direct VBA integration. But, it provides some workarounds such as using Power Query (available in both Excel and Power BI).

For instance, we can create a parameter in Power Query in Excel, modify it via VBA, and then refresh the data model, which could then be exported to Power BI via Power Query. It's not easy to keep the data synchronized in real-time between Power BI and VBA, but the Excel-Power Query-Power BI route works for scenarios where real-time synchronization is not required.

Implementation would look like this:

  1. In Excel, create a new Power Query (in the Data tab, select Get Data -> Launch Power Query Editor).
  2. In Power Query Editor, create a new parameter (Home -> Manage Parameters -> New Parameter). Enter required details and values.
  3. Write VBA code to modify this parameter value as needed (using Workbook.Queries method).
  4. Refresh Excel's data model (Data -> Refresh All).
  5. Import the updated data model into Power BI (Home -> Get Data -> Power Query).

Please note, that the exact steps may vary depending on your specific use-case requirements.

Step 5: Power BI Publishing

After you've created a report, you can publish it to the Power BI service.

  1. Click File > Publish > Publish to Power BI.
  2. If prompted, sign in to Power BI.
  3. Choose the workspace where you want to save the report.
  4. After publishing, you will see a success notification.

Please consider that workspace should have enough space to host the report and ensure that the data source used in the report is accessible to the Power BI service.

Conclusion

Though this method enables VBA Excel integration with Power BI, it's crucial to understand that this process has certain limitations, such as restricted real-time data synchronization. A much more robust solution would be migrating from Excel-VBA to a more advanced technology stack that integrates flawlessly with Power BI, if your use-case demands this.

2. Data Transformation and Processing

Requirements

  • Microsoft Excel
  • Power BI Desktop

We will focus on data transformation and processing using Power BI, Power Query (M), and VBA. Eventually, we will showcase how the processed data can be visualized using Power BI. To do this, we will start with some raw data in Excel, transform it with Power Query, automate the data manipulation using VBA, and generate insights using Power BI.

a. Starting with Raw Data

Let's assume that you already have some raw data in Excel. Suppose it's sales data from your company with columns like OrderDate, Region, Rep, Item, Units and UnitCost.

b. Importing the Data into Power Query

  1. Launch Power BI Desktop.
  2. Click on Get Data in the Home tab and select Excel.
  3. Navigate to your Excel file and select the table or range of cells you want to work with.

Power Query editor should open with your data. Now, let's do some transformations.

c. Transforming the Data with Power Query

Let's say we want to add a new column 'Total Sales' and count the number of sales by region.

  1. To add a new column, select Add column from the Home tab.
  2. In the right panel, select Custom Column.
  3. In the dialog box that appears, give your new column a name, 'Total Sales'.
  4. Under 'Custom column formula', enter the expression =[Units]*[UnitCost].
  5. Click OK.

Your new column should now appear in the editor.

  1. Now, to group by Region, go to the Transform menu and select Group by.
  2. In the dialog box, select Region as your column to group by, give your new aggregated column a name, 'SalesCount', and select Count as the operation.

Now, we have transformed our data and we can load it into the Power BI model.

  1. Click on Close & Apply in the Home tab.

Now our processed data is loaded into Power BI.

d. Automating Data Manipulation with VBA

We have data that gets updated frequently in Excel and we want to reflect these updates in the Power BI model. Here is a script to do this using VBA:

Sub Refresh_PowerQuery()

    ' This line updates the Power Query table.
    ActiveWorkbook.Queries("Your_Query_Name").Refresh
    
End Sub

You simply replace Your_Query_Name with the actual name of your query.

To ensure the query refreshes whenever the data changes, you could call Refresh_PowerQuery in the Worksheet_Change event:

Private Sub Worksheet_Change(ByVal Target As Range)

    ' This line calls the subroutine whenever a change happens in the worksheet.
    Refresh_PowerQuery
    
End Sub

This VBA script automates the data refresh process so that any changes in the Excel data source are reflected in the Power BI model.

e. Visualizing the Data in Power BI

Our transformed data is now loaded into the Power BI model. We can use this to create visuals:

  1. Under Fields on the right, tick the Region field and the 'SalesCount' calculated field.
  2. Go to the Visualizations pane and select an appropriate visualization (e.g., a bar chart).
  3. Customize the visual to your liking.

Conclusion: With the transformed data now available and VBA in place to automate data updates, you can start building out your interactive dashboard for business analytics. This setup allows you to easily manage and update your data in Excel, while giving you the robust data visualization tools of Power BI.

Hope this helps, and all the best with your project!

#Acquiring Data using Power Query M Language

The M language is a powerful data acquisition and transformation language that is used in Power Query. With this language, we can perform complex data transformations by simply writing a script. Power Query's user-friendly interface generates M code from our actions automatically.

In Excel Power Query tab, select 'Advanced Editor'.

let
    Source = Excel.Workbook(File.Contents("C:\Dataset\YourFile.xlsx"), null, true),
    YourTable = Source{[Item="YourTable",Kind="Table"]}[Data]
in
    YourTable

This code is indicating that from the Excel Workbook located in the specified path, fetch YourTable.

#Data Modeling using Data Analysis Expressions (DAX)

Data Analysis Expressions (DAX) is a formula expression language used in Analysis Services, Power BI, and Power Pivot in Excel. DAX formulas include functions, operators, and constants that can be used to define custom formulas in Power Pivot in Excel.

  1. Creating a new column using DAX in Power BI

In the Power BI desktop 'Modeling' tab, click on 'New Column'.

NewColumn = RELATED('Table'[Column])

This RELATED() function is used to get data from a related table.

  1. Creating a measure using DAX in Power BI

In the Power BI desktop 'Modeling' tab, click on 'New Measure'.

Total Sales = SUM('Sales'[SalesAmount])

#Displaying the Data in an Interactive Dashboard

  1. Load both of these tables (the one imported using M and the one transformed using DAX) into Power BI.
  2. Drag and drop the fields on to the report view and arrange them in a visually appealing manner.
Visual1 = COUNTROWS('Table')
  1. To highlight a certain data point, you can use conditional formatting or create DAX measures.
Highlight = IF([Measure] > Threshold, "Yes", "No")
  1. To create an interactive dashboard, you can use slicers or drill-down features offered in Power BI. This can be set up from the visualization pane.
  2. Publish this report to Power BI service to see the dashboard in action. This can be done by clicking on 'Publish' in the 'Home' tab in Power BI Desktop.

#Integration with VBA (Optional)

If you wish to automate the data extraction, transformation, and loading process, you can use VBA (Visual Basic for Applications) to automate the tasks of pulling data from Excel files using Power Query (M) and creating/modifying DAX measures/columns.

Sub Test()

    Dim PQ As Object
    
    Set PQ = CreateObject("Microsoft.PowerBI.PowerQuery")
    PQ.RefreshAll
    
End Sub

Please note that direct interaction between VBA and Power BI is limited and typically, Excel is used as a medium to transfer data between the two.

In conclusion, Power Query M language and DAX are powerful tools for data transformation and analysis in Power BI and they can be utilized to fulfill quite complex and specific data-related tasks. This is how we can implement the basics of DAX and M associations for your project.

Power BI Data Integration

In this section, we will explore how to integrate data from Excel to Power BI, create a data model and develop a report using DAX, VBA, and M (Power Query) language.

Note: This solution assumes that Power BI Desktop is already installed and we're considering "data.xlsx" as the Excel data source with the "SalesData" spreadsheet.

Step 1: Importing Data to Power BI from Excel

To load data from Excel to Power BI, follow the below steps:

  1. Open Power BI Desktop.
  2. Click on the "Home" tab at the top, within the "External Data" group, choose "Excel".
  3. Browse and open "data.xlsx".
  4. Choose the data (spreadsheet) in the Navigator window and click on "Load".

The Excel data has been successfully loaded into Power BI.

Step 2: Cleansing and Transforming Data using Power Query

  1. If you need to clean or transform the data, click on the "Home" tab, in the "Transform Data" drop-down click on "Transform Data". Here you can apply M (Power Query) language to perform actions such as removing rows with missing data, changing data types, etc.
= Table.RemoveRowsWithErrors(SalesData)
= Table.TransformColumnTypes(SalesData,{{"Order ID", Int64.Type}, {"Quantity Ordered", Int64.Type}})
  1. Close the Power Query Editor once transformations are done. The data will be loaded back into Power BI.

Step 3: Creating a Data Model using DAX

Next, we create a simple data model to illustrate sales by month:

  1. Click on the "Modeling" tab and choose "New Table".
  2. Type in the DAX expression to create the table.
SalesByMonth = SUMMARIZE('SalesData', SalesData[Month], "Total Sales", SUM('SalesData'[SalesAmount])) 

We now have our data model "SalesByMonth" that contains aggregated sales by each month.

Step 4: Developing a Report and Visualizing Data

  1. Go to the Report view by clicking on the third icon in the left bar.
  2. From the "Visualizations" pane, choose desired visual (for example, Line Chart).
  3. Drag the "Month" field to the Axis and the "Total Sales" field to Values.

We've successfully created a report showing the trend of sales over months.

Step 5: Automating Processes with VBA

To automate the refresh process of Power BI with new data from Excel, we can use Power Automate. However, VBA can be used to automate data cleaning and transformation in Excel prior to loading into Power BI.

Below is a VBA code for removing blanks in column A in Excel:

Sub RemoveBlanks()
    Columns(“A:A”).Select
    Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub

After making changes to the Excel data, save and close the file. Refresh the Power BI report to update it with the changes.

With Power BI, data integration and modeling using various tools such as Power Query, DAX, and VBA offers the advantage of handling complex data structures, automate the data transformation process, and create efficient data models.

You now have a working version of Part 4: Power BI Data Integration of your project.

Understanding the VBA Development Environment

Visual Basic for Applications (VBA) is the programming language of Excel and other Office programs. This section will cover the basics of the VBA development environment and introduce the key components.

Accessing VBA Editor

VBA editor can be accessed in Excel by pressing ALT + F11. The VBA editor window will open up.

Exploring the Project Explorer

On the left side, you can see the project explorer. It contains all the open Excel files (workbooks) and their components like worksheets and modules.

Following code is to add a new module:

Sub addModule()
    ThisWorkbook.VBProject.VBComponents.Add vbext_ct_StdModule
End Sub

The added module then can be accessed by double clicking on it and writing the code. Below is the code to create a simple HelloWorld procedure:

Sub HelloWorld()
    MsgBox "Hello, World!"
End Sub

After writing the above code in the module, you can run it by pressing F5.

Properties Window

The Properties window is located at the bottom of the Project Explorer window. It shows the properties of the selected component in the Project Explorer. For example, if a Worksheet component is selected, it will show the Name, Visible, and other properties.

Code Window

Code Window is the area where you write your VBA code. Every component (worksheet, module, etc.) has its own code window.

Immediate Window

The Immediate window is used for debugging and evaluation of your code. It can be opened by pressing CTRL + G in the VBA editor.

A simple use of the Immediate window can be evaluating expressions. For example, writing ? 2+2 will give 4.

Inbuilt Functions

VBA contains built-in functions so that you do not have to code them from scratch every time. For example, MsgBox is a function to display a message to the user, or InputBox is a function to get input from the user.

Dealing with Errors

VBA provides error handling mechanisms to gracefully deal with errors that might occur during the execution of the VBA code. This can be handled using On Error Resume Next and On Error GoTo statements.

Working with Power BI

You may use the Power BI REST API along with the Excel VBA Web requests. This gives the ability to refresh datasets, import new datasets and even get the status of the currently imported datasets.

Conclusion

This section has introduced you to the VBA development environment. To get the most out of VBA, you will need to practice and learn how to handle different types of data and objects in Excel using VBA.

Creating and Managing User Forms

For form creation, Microsoft Power Apps is one of the best options due to its deep integration with other Microsoft suite of products like SharePoint, Power Automate, Excel, Power BI, etc.

1. Creation of User Forms Using Power Apps

Step 1: Creation of the Form

  • Open Power Apps and create a new Canvas app.
  • Go to the Insert menu, select Form and choose Edit.
  • The Form will be created in the Canvas. Resize it to suit as per requirement.

Step 2: Connecting DataSource

  • Select your Form and go to the Properties window.
  • You will see an option for Data Source. Connect this to the SharePoint list or an Excel spreadsheet where you want to record form responses.

Step 3: Adding Fields

  • Now, choose the fields for your form by clicking on "Edit fields" in the Properties window.
  • Here, you can add, remove or reorder the fields as required.

Step 4: Customizing the Form

  • By default, Power Apps provides a very basic form. You can customize it through the Power Apps canvas.
  • You can resize the fields, change the font, modify the color scheme, etc.

Now we have a basic form. However, this form doesn't do anything yet because we have not associated any actions with it.

2. Form Submission and Data Management

Handling form submissions is a common operation that is done using Power Automate. Here, we are showcasing how to handle form submission and write data into a SharePoint list.

Step 1: Creation of Power Automate Flow

  • Go to Power Automate and create a new Flow. Choose the trigger as Power Apps.
  • Now, you need to add an action, which will be triggered when a form is submitted. In our case, we want to add form data to a SharePoint list.

Step 2: Configuring the Action

  • Choose the action as "Create item" and select the SharePoint list.
  • You can see all the fields corresponding to the SharePoint list appear here.
  • Use the "Ask in Power Apps" option in the dynamic content to get the values from the form.

Step 3: Integration With Power Apps

  • Now, go back to your form in Power Apps.
  • In Power Apps, select the Submit button and go to the OnSelect property.
  • Use the function 'PowerAppsbutton.Run' where PowerAppsbutton is the name of the Power Automate flow. Pass the form fields as arguments to this function.

3. Viewing the Responses in Power BI

Now we are ready with the form and have the data in SharePoint. So let's integrate this data with Power BI for visualization and reporting.

Step 1: Connecting to SharePoint List

  • Open Power BI and select Get Data.
  • Choose SharePoint Online List and provide the URL of your SharePoint site.
  • Power BI will list down all the lists available. Choose your list and click Load.

Step 2: Creating Reports

  • Once data is loaded into Power BI, you can use the fields to create visuals and reports.
  • This process is straightforward with drag-and-drop operations to create visuals.

Now, you have a seamless flow of data from the user filling out a form in Power Apps, that data being handled by Power Automate, saved in SharePoint, and finally visualized in Power BI.

You can refine this process as per your requirements and enhance your form or reports.

7. Power Apps for Data Manipulation

Power Apps is a low-code, high productivity application platform that enables you to create modern web and mobile applications. In this tutorial, I will show you how to create a Power App that manipulates data in Power BI.

Prerequisites

  1. Power Apps installed
  2. Power BI installed with a dataset and dashboard ready to receive data.

Setting Up Power App

  1. Navigate to Power Apps studio, select 'Create' then 'Canvas App from blank', let's name it DataManipulationApp.

  2. Save the app firstly. In the Power Apps studio, click on 'File' and 'Save'.

  3. We need to add our Power BI dataset as a data source. To do this, click on 'View' > 'Data sources'. Click '+ Add data source', then select 'Power BI'.

  4. In the menu that appears, find the name of your Power BI dataset and select it. Click 'Connect'.

Creating the User Interface

The user interface will consist of text inputs for the user to input the data, and a button to submit the data.

  1. Go back to the app design view. From the 'Insert' menu select 'Text'->'Text input'. Position and size the textbox as needed. Repeat for as many fields as required for your dataset.

  2. Within the 'Insert' menu, select 'Button'. Give it a relevant name e.g. Upload Data.

Implementing Data Manipulation

Now we will write the logic that will execute when the button is clicked. For this tutorial, we'll assume that we have a dataset in Power BI that has two columns: Column1 and Column2.

  1. Select the button and go to the 'OnSelect' property.

  2. You will need to input a formula that adds the data from your text inputs to your Power BI dataset. The basic formula for this is Patch([Your Data Source], Defaults([Your Data Source]), {Column1:TextInput1.Text, Column2: TextInput2.Text}).

  3. Replace [Your Data Source] with the name of your data source (your Power BI dataset). Replace Column1 and Column2 with the names of your dataset's columns. Replace TextInput1.Text and TextInput2.Text with the text fields that correspond to each column.

To refresh your Power BI dataset with the new data:

PowerBIIntegration.Refresh()

The final code in 'OnSelect' should look like this:

Patch(YourDataSource, Defaults(YourDataSource), {Column1: TextInput1.Text, Column2: TextInput2.Text});
PowerBIIntegration.Refresh();

Integration with Power BI

To view the updated data in your Power BI dashboard, you will need to refresh the dataset. You can do this manually, or automate it with Power Automate.


This is a fundamental Power App, but you can extend it to suit your needs. Remember to save and publish your app when your design and functions are complete. Your users can then use your Power App to manipulate the data that appears in your Power BI dashboard.

Data Visualization in Power BI

I'll be providing a step-by-step procedure of creating a sales performance dashboard assuming we have a data of a certain sales department. The dataset is in Excel and includes: EmployeeName, Region, Quarter, Sales. You should replace these fields with your corresponding data.

Load and Transform Data

  1. In Power BI Desktop, click on "Home" > "Edit Queries" > "Data source settings".
  2. Choose your Excel file and load your dataset.
  3. Using Power Query (The skills you already have according to your message), do necessary transformations such as changing data types, handling missing data, etc. Then, click "Close & Apply" to load the data into Power BI.

Design Reports

  1. Always start with a blank canvas. Remove every visual by default and add them when necessary.

  2. Start with the Title. Insert a text box from "Home" > "Text box". Write a descriptive title like "Sales Performance Dashboard". Adjust the size and place it at the top.

Add Visuals

Let's add various visuals to our report.

Bar Chart Visual

Assuming you want to see sales by employee,

  1. Click on "Bar chart" icon from Visualizations pane.
  2. Drag the EmployeeName column to the "Axis" field and Sales column to the "Values" field. Adjust the sizing and positioning.

Slicer Visual

To help filter data by region,

  1. Click on "Slicer" icon from Visualizations pane.
  2. Drag Region column to the "Values" field. Make sure it is positioned and sized well.

Pie Chart Visual

To see sales distribution across quarters,

  1. Click on "Pie chart" icon from Visualizations pane.
  2. Drag Quarter column to the "Legend" field and Sales column to the "Values" field. Place and size it correctly.

Table Visual

To show detailed data like a table in Excel,

  1. Click on "Table" icon from Visualizations pane.
  2. Drag all necessary columns to the "Values" field. Adjust its sizing and positioning.

Remember, you can style and format all these visuals from the "Format" tab under Visualizations. Play with different settings, like colors, fonts, backgrounds, borders, and titles until you're satisfied with the look.

Publish the Report

  1. Click "Publish" from the home tab.
  2. Choose your workspace in Power BI service.
  3. Check the report in Power BI online if everything is fine.

Your dashboard is now ready. All filter options, slicers, and other interactive elements you added are interactive in your Power BI online too. You can share this dashboard with others in your organization.

Remember, data modeling and preparations are crucial before visualization. Spend most time in cleaning and preparing the data. Visualization is just the last 10% of your overall data project! Enjoy your new dashboard.

Advanced Analytics with Power BI

In this section, we will focus on implementing advanced analytics into our Power BI and VBA-driven framework. This will involve creating analytics measures, using the DAX language, that will allow us to gain deep insights in our Power BI dashboards.

We will implement a measure to calculate the profit margin, which we'll then use to create a visual that will highlight the profit margin variation over a set period. We will also create clustering using Power BI’s Advanced Analytics feature.

Prerequisites:

  • Pre-loaded data in Power BI
  • DAX formula knowledge (as mentioned in "Basics of DAX and M (Power Query) Language").

Step 1: Creating a DAX Measure

Let's start by creating a new measure in Power BI that calculates the profit margin.

If SalesTable is your dataset which contains the data columns "Total Revenue" and "Total Cost",

We can have a DAX formula for Profit Margin as

Profit Margin = DIVIDE(
    (SUM('SalesTable'[Total Revenue])-SUM('SalesTable'[Total Cost])), 
    SUM('SalesTable'[Total Revenue])
) * 100

This measure calculates the difference between total revenue and total cost, divides it by the total revenue, and then multiplies the result by 100 to obtain the profit margin in percentage.

Step 2: Integrating DAX Measures into Power BI Visuals

Once we have our "Profit Margin" measure ready, we can build a visual to better understand how this metric changes over time. Here's how:

  1. Add a line chart into your Power BI dashboard.
  2. Drag over the "Date" field (or any time-based field) into the axis well of the line chart.
  3. Drag the "Profit Margin" measure you created earlier into the values well.

This will create a line chart showcasing how the profit margin is fluctuating over time.

Step 3: Implementing Clustering on Power BI

Now, let's illustrate how we can leverage Power BI’s Advanced Analytics feature to create clustering on our data.

This approach can help us realize some inherent groupings within our data that could be pivotal in business analysis.

  1. Drop a scatter chart into your dashboard.
  2. Drag the relative fields into the Axis section.
  3. In the Visualizations pane, select the ... More options button for the scatter chart and choose the Automatically find clusters tool.

Power BI will instantly analyze your data and develop a cluster model.

Integrating With VBA

With the help of Power BI API and VBA, we can automate some components of Power BI report. Unfortunately, we lack analytical components like creating a measure or applying machine learning algorithms provided by Power BI in VBA environment. Therefore, the advanced analytics part is not directly achievable by VBA. However, VBA can help automate the refreshing of Power BI datasets or performing kind of actions based on Power BI data.

Conclusion

This section provides practical implementations of complex DAX measures and Power BI's advanced analytics feature. DAX allows us to adapt our data reports to suit our analysis needs, while Power BI's clustering feature provides further depth for data exploration. Nevertheless, the application of VBA in advanced analytics within Power BI is limited due to restrictions in the API; most of the advanced operations require direct interaction with Power BI.

SharePoint Integration with Power Automate

Given your proficiency with Power BI, VBA, Excel, Power Apps, and SharePoint, we are going to leverage Power Automate for orchestration. Power Automate will act as the bridge between SharePoint and your Power BI or VBA environment. This solution is implemented with DAX, Excel, M (Power Query), Power BI, VBA, and Power Automate.

Prerequisites

You have set up SharePoint lists which are being used for your data.

Building a Flow in Power Automate

Power Automate allows us to build workflows (known as "flows") that glue together our SharePoint lists and Power BI dashboards.

1. Create a New Automated Flow

Login Power Automate and click "Create". Choose "Automated flow", enter a flow name, and choose the "When an item is created" SharePoint trigger. Then, click "Create".

ConnectToSharePointList(, "When an item is created", )

2. Establish Connection to Your SharePoint List

On next screen, establish connection with your SharePoint list by providing the site address and list name.

SetSharePointSiteAddress()
SetSharePointListName()

3. Add an Action

Click "+New step" to add an action. Search for "Power BI" and select "Add rows to a dataset".

AddAction("Power BI", "Add rows to a dataset")

4. Connect to Power BI Dataset

On the next screen, provide the workspace, dataset and table where you want to push the data.

ConnectToPowerBIDataset(, , )

5. Map SharePoint List Columns to Power BI Table

Map your SharePoint List columns to your Power BI table's fields.

MapFields(, )
MapFields(, )

Save this flow. It will add data to your Power BI table whenever a new item is created in the SharePoint list.

Connect VBA Application with SharePoint

Presumably, your VBA application is within an Excel workbook. You can use the Excel Object model to interact with SharePoint.

Dim MySite As Object
Set MySite = CreateObject("SharePoint.SPSite")("")

Dim MyWeb As Object
Set MyWeb = MySite.OpenWeb()

Dim MyList As Object
Set MyList = MyWeb.Lists("")

Dim item As Object
Set item = MyList.Items.Add()

item("FieldName1") =  ' Use your data here from Excel/VBA
item("FieldName2") = 

item.Update()

MySite.Dispose() ' Clean up
MyWeb.Dispose()

This will add data from your VBA application to your SharePoint list, triggering your Power Automate flow and ultimately updating your Power BI dashboard.

Completing the Implementation

With this, you have built a practical, end to end solution that spans multiple technologies and platforms. You can now manually manipulate data within an Excel workbook that hosts VBA, commit that data to a SharePoint list, have the commit action trigger a Power Automate flow and finally, update a Power BI dashboard.

Remember to secure your implementation as both SharePoint and Power BI are typically cloud hosted and would be receiving and hosting sensitive data. Also ensure that the SharePoint list and Power BI have identical data structures to prevent data corruption or loss.

11. Data Modelling Techniques

Data modelling is the method of organizing and structuring data so it can be used to generate insights. In Power BI, data models consist of tables, relationships, and DAX formulas. The process of creating a well-structured data model is crucial in developing robust Power BI reports.

Below is a practical step-by-step guide on how to implement data modelling in Power BI.

Importing and Establishing Relationships Between Tables

Assuming you have the necessary data tables ready in your Excel file, the first step in data modeling is to import these tables into Power BI.

# Use the Power BI Get Data function to import the necessary tables from Excel.
# After the tables are imported, we'll establish relationships between them.
# From the Power BI menu, select Home > Manage Relationships.
# In the Manage Relationships window, you can view, edit, create, and delete relationships.

Creating a Date Table

A date table is a common element in data models that helps you to perform date-specific functionalities. Given that we don`t know the specifics of your data, the date table generation will be generic.

# Let's say you want to create a date table to dig deeper into your sales data.
# Use the below DAX formula to create a date table:

DateTable = 
   ADDCOLUMNS (
      CALENDAR (DATE(2010,1,1), DATE(2025,12,31)),
         "Year", YEAR ([Date]),
         "Month", FORMAT ([Date], "MMMM"),
         "MonthYear", FORMAT ([Date], "MM-YYYY"),
         "Quarter", "Q" & FORMAT ([Date], "Q"),
         "Day", DAY ([Date]),
         "Weekday", WEEKDAY ([Date])
   )

Here, a new table named "DateTable" is created spanning from 1st Jan 2010 to 31st Dec 2025.

Creating and Using DAX Measures

DAX (Data Analysis Expressions) is a formula language that you can use in Power BI to create custom calculations for fields in your data models.

# For instance, if we want to create a new measure that calculates total sales, we can do the following:
# Go to Modelling Tab > New measure.
# In the formula bar, type in the following DAX formula and press enter.

Total Sales = SUM('Sales'[Sales Amount])

The above code will calculate the total sales. This DAX formula sums up all the values in the 'Sales Amount' column of the 'Sales' table.

Enhancing Data with Calculated Columns

Calculated columns add new data to our tables, allowing us to expand our data model's capabilities.

# For example, if we want to calculate a 'Profit Margin' calculated column in the 'Sales' Table:

Profit Margin = [Total Sales] - [Total Costs]

Here, a new column "Profit Margin" is added to the Sales table. It's calculated as the difference between the total sales and the total costs.

Making Use of Hierarchies

Hierarchies are another way to enhance your data model. They allow you to "drill down" for more granular details.

# For example, let's create a 'Date Hierarchy' within the 'DateTable'. 
# Drag and drop the 'Year', 'Quarter', 'Month', and 'Day' columns onto each other in the Fields pane.
# This will create a new hierarchy, which you can rename as 'Date Hierarchy'.

Now, we can use this 'Date Hierarchy' in our Power BI visuals to allow for interactive drilling into our time-related data.


The process outlined here have furnished your data in Power BI, creating robust relationships and structures for creative, effective data visualisation. As the specifics (table names, field names, exact business logic) of your data model are unknown, the DAX expressions and Power BI steps discussed are quite generic. Please replace the placeholders and generic table/column names with those that align with your use case.

Remember, data modeling is iterative, requiring constant refinement and tweaking as per your reporting objectives.

Custom Report Design in Power BI

Prerequisite

Make sure that you have your dataset loaded in Power BI Desktop. In this tutorial, we will assume that a dataset has already been loaded.

Step 1: Creating a New Report

  1. Open Power BI Desktop.
  2. Click on File > New to create a new report.

Step 2: Selecting the Visualization

  1. In the Fields pane, expand the table containing the fields you want to work with.
  2. Drag the desired field onto the canvas. Power BI creates a table by default.
  3. If you want to change the visualization type, select a different type from the Visualizations pane.

Step 3: Customizing the Visualization

We will consider a Bar Chart for customization:

  1. Click on the newly created bar chart to select it.

  2. In the Visualizations pane, click on the Format button (represented by a paint roller icon).

  3. Here, you can customize several aspects of the chart. Let's adjust a few:

    • Data colors: Click on Data colors. Change the colors as you see fit.
    • Title: By default, the title derives from the fields you're using. To customize it, click on Title and adjust the Title Text.
    • X-Axis and Y-Axis: You can adjust style, color, and type of the axis from these parameters.
  4. Similarly, you can use other options in the Format pane to further customize your visualization.

Step 4: Adding Filters to the Visualization

  1. Select the visualization and go to the Filters pane.
  2. Drag any field onto the filter area. There are three types of filters –
    • Visual level filters that apply to just the selected visualization,
    • Page level filters that apply to all visualizations on the current page,
    • Report level filters that apply to all visualizations within the report.
  3. Once the field is in the filter area, specify the terms of the filter.

Step 5: Creating Additional Visualizations and Arranging Them

Repeat Steps 2 to 4 to add as many visualizations as needed. Arrange them on the canvas to form a coherent dashboard. You may resize and move the visualizations as needed.

Step 6: Saving and Publishing the Report

  1. When all visualizations are created, go to File > Save and save the report.
  2. To publish, go to File > Publish. If prompted, sign in with your Power BI account information.

Conclusion

You have successfully designed a custom report in Power BI. You can download the report from the Power BI online service, share it with others, or integrate it with other applications as needed.

Remember that the customization options in Power BI are extensive. The options we covered here are just the tip of the iceberg. With practice, you can create highly detailed, complex, and interactive reports.

Here is the end of our practical implementation of custom report design in Power BI Desktop.

The implementation of Business Analytics Principles using Power BI and VBA would involve creating a user-friendly and interactive dashboard that focuses on key business metrics and KPIs. I will provide the real-time implementation using Power BI and VBA for this part of your project. Let's dive into it.

1. Actionable Insights with DAX

To provide actionable insights, we will use DAX to analyze our data and provide meaningful results. We already discussed the basics of the DAX. Here, we will create a measure in the Power BI report to analyze our existing data.

Sales Growth = 
CALCULATE(
    SUM( 'Sales'[Sales Amount] ),
    FILTER(
        ALL( 'Sales'[Sales Date] ),
        'Sales'[Sales Date] > MAX( 'Sales'[Sales Date] - 365 )
    )
) - CALCULATE(
    SUM( 'Sales'[Sales Amount] ),
    FILTER(
        ALL( 'Sales'[Sales Date] ),
        'Sales'[Sales Date] <= MAX( 'Sales'[Sales Date] - 365 )
    )
)

This DAX measure calculates the sales growth comparing the sum of sales in the last 365 days with the sum of sales in the previous period. This type of measure could enable a dashboard with actionable insights for business decision-making processes.

2. VBA Macro to Export Data to Power BI

For automating the data export to Power BI, we can use VBA to create a macro in Excel.

Sub PBI_Export()

Dim PBI As Workbook
Dim ws As Worksheet

    'Create a new Workbook for Power BI
    Set PBI = Workbooks.Add
    'Copy each worksheet to new workbook
    For Each ws In ThisWorkbook.Worksheets
        ws.Copy after:=PBI.Sheets(PBI.Sheets.Count)
    Next ws
    'Delete first blank worksheet in new workbook
    Application.DisplayAlerts = False
    PBI.Sheets(1).Delete
    Application.DisplayAlerts = True

    'Save and Close the new workbook
    PBI.SaveAs "Path_To_Save\ForPBI.xlsx"
    PBI.Close SaveChanges:=False

End Sub

This macro would create a new Excel workbook, copying all worksheets from the current workbook to the new one, save and close it. 'Path_To_Save' would be the path where you want to save the exported file.

3. Power Query for Business Analytics

We can perform some advanced analytics using Power Query, for example, categorizing sales data.

In this demonstration, I am creating a conditional column in Power Query to categorize the "Sales Amount" to different statuses (Low, Moderate, High, Very High).

Navigate to Transform Data -> Home -> Add Column -> Conditional Column. We can put this condition -

if [Sales Amount] < 20000 then "Low"
else if [Sales Amount] >= 20000 and [Sales Amount] < 50000 then "Moderate"
else if [Sales Amount] >= 50000 and [Sales Amount] < 100000 then "High"
else "Very High"

The above analyse results can feed back into the Power BI report to get a clear vision of the sales status.

4. Power Automate for Alerting System

Finally, we will use Power Automate to send email alerts when a particular condition or threshold is met in Power BI. In this case, assume we want to receive an email when the status column we created above, shows 'Very High' for a particular number of times.

From Power BI service -> My workspace -> Automate -> Power Automate -> Create a new flow -> Run history -> New step -> Power BI -> Add a condition -> Get rows -> Select from SharePoint -> Apply to Each -> Send an email.

By creating a flow in Power Automate, we can set up an email alert system that’s triggered when a certain condition occurs in Power BI. Use the appropriate function to find a condition based on your need.

This practical implementation puts business analytics principles into action using Power BI, Excel, Power Apps, Power Automate, SharePoint, and VBA by creating interactive and meaningful dashboards for decision making, automated data export from Excel to Power BI, business analytics with Power Query, and an alerting system when a threshold is met.

The mentioned tools help data transformation, app development, advanced analytics, data visualization, data modeling, report designing, and business analytics using DAX, Excel, M (Power Query), Power BI, and VBA languages. Remember to replace all placeholder text with your actual values.

Enhancing User Interaction with VBA

Section 1: Leveraging VBA Events

User interaction with VBA can be enhanced by implementing events triggered by user actions. Events like Button_Click, Workbook_Open, or Worksheet_Change can be used to automate certain tasks when the user performs specific actions.

Here's an example of how to implement the Worksheet_Change event to automatically update a Power BI connection file when a user changes a Excel cell value:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub

    ' Refresh Power BI connection
    Dim PBI_con As WorkbookConnection
    Set PBI_con = ThisWorkbook.Connections("Power_BI_Connection")
    PBI_con.Refresh
End Sub

In this script, if data in cell A1 is changed, the Power BI connection is refreshed, allowing real-time synchronization of Excel data with Power BI.

Section 2: User Forms in VBA

User Forms can provide an intuitive interface for user interaction. Below is a simple user form implementation:

Let's create a User Form that captures user input and reflects the changes in an Excel workbook, ultimately getting reflected in the Power BI report. This is a simple method of how VBA can enhance the user experience.

Private Sub CommandButton1_Click()
    ' This creates a new row for entry
    RowCount = Worksheets("Sheet1").Range("A1").CurrentRegion.Rows.Count
    With Worksheets("Sheet1").Range("A1")

        ' We add the entry details to each column
        .Offset(RowCount, 0).Value = Me.TextBox1.Value ' Column A
        .Offset(RowCount, 1).Value = Me.TextBox2.Value ' Column B
        .Offset(RowCount, 2).Value = Me.TextBox3.Value ' Column C

    End With

    TextBox1.Value = ""
    TextBox2.Value = ""
    TextBox3.Value = ""

End Sub

Here, we have a simple form with three input boxes and a button. When the button is pressed (the CommandButton1_Click event), the data the user has inputted into the text boxes get added to the next available row in the Excel sheet ("Sheet1").

Section 3: Interactions between Excel and Power BI with VBA

Power BI can load Excel workbook data through a connection. This connection can be refreshed with VBA to have real-time updates on Power BI based on Excel data.

A VBA script that refreshes the data connection with Power BI when Excel data changes:

Private Sub Workbook_AfterSave(ByVal Success As Boolean)
    If Not Success Then Exit Sub

    ' Refresh Power BI connection
    Dim PBI_con As WorkbookConnection
    Set PBI_con = ThisWorkbook.Connections("Power_BI_Connection")
    PBI_con.Refresh
End Sub

In this script, we are enhancing user interaction by updating the Power BI dashboard automatically after every successful save event in the workbook.

With the implementation of these VBA scripts, a seamless interactive experience between Excel, VBA, and Power BI is created. The user can perform manual data manipulation in an intuitive user form and visualize real-time results in Power BI, enhancing the overall interactivity and convenience of data manipulation and visualization tasks substantially.

Leveraging Power Automate for Automation

Power Automate is a powerful platform provided by Microsoft to create automated workflows between multiple applications and services. Integration of Power Automate in your VBA application will allow you to automate your routine business processes.

Assuming you are working on a scenario where your VBA application modifies data in an Excel file and you want to sync this data to your Power BI reports. You may also want to notify you via email whenever this data gets updated.

Please ensure that Power BI and Power Automate are set up correctly before proceeding.

Build a Power Automate Flow

  • Navigate to Power Automate and select + New > Automated-from blank to create a new flow.
  • Choose a name for your flow (for e.g., ExcelToPowerBI) and select Skip.
  • The PowerAutomate editor is now open. Please click on the +New step
  • Now you will add a trigger that initiates the flow. Because our workflow is based on the modification of an Excel file, you could use When a file is modified (OneDrive) or any other triggering condition based on your requirements.
  • You will then need to specify the Location, Document Library, and File to monitor.

Update Power BI DataSet

  • To add a new step that updates your PowerBI data, click on +New step and choose Power BI-Refresh dataset action.
  • In the Refresh a dataset action, configure the Workspace and Dataset fields to match the target PowerBI dataset you want to update.

Send an Email

  • You will now add another step by clicking on +New step. Please select the Send an email (Office 365 Outlook) action to send an email whenever the data gets updated.

  • You will configure the fields To, Subject, and Body as per your requirements.

  • Finally, you can click on Save to save your flow.

You have successfully created a Power Automate flow for your process.

Update your VBA Application

Now you'll need to call this flow from your VBA application. You will use the Invoke Power Automate flow API to do this.

url = "Your Power Automate flow URL here"
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")

With HTTPReq
    .Open "POST", url, False
    .setRequestHeader "Content-Type", "application/json"
    .send ("{}")
End With

Please replace Your Power Automate flow URL here with the URL of your Power Automate flow. The Invoke Power Automate flow API allows you to trigger your Power Automate flow programmatically.

By integrating Power Automate into your VBA application, you can automate many routine tasks such as data synchronization and notifications. You can expand this concept to other areas of your application as well.

The above steps are an implementation of automation using Power Automate. Remember to replace the placeholders like the Power Automate flow URL, DataSet details, and Email details with actual values.

Dashboard Design and Implementation

This section primarily focuses on creating an interactive dashboard, which forms the capstone of your project. The guide below is an implementation of a Power BI dashboard that integrates with a VBA application, mainly using Power BI, Power Apps, and Power Automate.

1. Initial Dashboard Design

Use the following code in your VBA application to create a connection with your Power BI service. You will inject data into your Power BI dashboard using this connection:

Sub ConnectToPowerBI()
    Dim PBIConn As Object
    Set PBIConn = CreateObject("ADODB.Connection")
    
    ' Use your Power Bi credentials to establish a connection
    PBIConn.Open "Provider=MSOLAP.8;" & _
                 "Integrated Security=ClaimsToken;" & _
                 "Data Source=https://analysis.windows.net/powerbi/api;" & _
                 "Initial Catalog=PowerBI;"
End Sub

2. Manipulate and Input Data into Dashboard

Use Power Apps to manipulate the data:

Patch('[dbo].[Sales]', {ID1: TextInput1.Text, ID2: TextInput2.Text, SalesVolume: TextInput3.Text})

Then, using your VBA connection, inject data from your spreadsheet into your Dashboard in Power BI:

Sub UpdateDashboard(PBIConn As Object)
    Dim WB As Workbook
    Dim WS As Worksheet
    Set WB = ThisWorkbook
    Set WS = WB.Worksheets("Sheet1") 'or your actual sheet name
    Dim Rng As Range
    Set Rng = WS.Range("A1:D20") 'or your actual data range

    Dim cmd As Object
    Set cmd = CreateObject("ADODB.Command")
    Set cmd.ActiveConnection = PBIConn
    cmd.CommandType = adCmdTableDirect
    cmd.CommandText = "DashboardData" 'your actual Power BI Table
    
    ' Loop through each row and column of your range
    Dim RowNdx As Long
    Dim ColNdx As Integer
    Dim rngArray() as Variant
    rngArray = Rng.Value
    For RowNdx = LBound(rngArray, 1) to UBound(rngArray, 1)
        cmd.Parameters.Append cmd.CreateParameter("@Row", adBigInt, adParamInput, , RowNdx)
        For ColNdx = LBound(rngArray, 2) To UBound(rngArray, 2)
            cmd.Parameters.Append cmd.CreateParameter("@Value" & ColNdx, adVarChar, adParamInput, 100, rngArray(RowNdx, ColNdx))
        Next ColNdx
        cmd.Execute
        cmd.Parameters.Delete "@"    ' Clear parameters after execution
    Next RowNdx
End Sub

3. Automate Data Refresh in Power BI Using Power Automate

Create a flow in Power Automate to refresh the Power Bi dataset:

1. Click on "Create" -> "Automated Flow" -> "Skip".
2. Name your flow and choose "Power BI Button clicked" as the trigger.
3. Then, add new steps "Initialize Variable" to store the GroupId and DatasetId.
4. Next, add "Refresh a dataset" and configure with GroupId and DatasetId variables.
5. Finally, Save the your automated flow.

4. Finalize Dashboard

Interactivity and data transformation allows users to utilize data more efficiently:

  1. Use "Slicers" and "Drillthrough filters" for interacting with data (e.g., slicing data by geography or time periods).
  2. Implement "Row-level security" to ensure that users only have access to the data they should.

Remember to add visuals, themes and incorporate your organization's branding to create a professional-looking dashboard.

This entire implementation forms a practical approach to design, implement, and automate a dashboard using Power BI, Excel (VBA), Power Apps, and Power Automate.

Quality Assurance and Testing of a VBA Application

The following code snippets and explanations indicate how to proceed with the quality assurance and testing processes for your VBA application within the Excel environment.

1. Implementing Simple Debugging

VBA developers typically use the Debug.Print statement to print values into the Immediate Window, which is useful for checking current status, variable values, or function returns.

Sub TestDebugPrint()
    Dim x As Integer
    For x = 1 To 5
        Debug.Print "Value of x is: "; x
    Next x
End Sub

When you run this code using F5, you'll notice output showing up in the Immediate Window (ctrl+G in the VBE). This is a simple, but effective way to debug your code. If you don't see the value you expect, you know something's amiss.

2. Using Breakpoints

VBA provides the ability to halt the execution of your program at specific points, enabling you to examine the status of your application at those points. These are called breakpoints.

To set a breakpoint, click in the left-hand gutter of the code module where you want the breakpoint or position the cursor on the desired line and press F9.

Sub TestBreakpoint()
    Dim x As Integer
    For x = 1 To 5
        'Breakpoint placed on the following line
        Debug.Print "Value of x is: "; x
    Next x
End Sub

3. Stepping Through the Code

Instead of running the entire code at once, you can also step through your code line by line to see exactly what's happening. This is incredibly useful when diagnosing unanticipated behavior.

You can step through your code by pressing F8. Each successive press of F8 will move you to the next line of your program.

4. Using the Watch Window

The Watch Window is a feature of VBA that allows you to keep track of the value in certain variables during the execution of your code. To set a Watch, you have to select the variable you want to keep track of and go to Debug > Add Watch.

Sub TestWatch()
    Dim x As Integer
    'A Watch would be placed for variable "x"
    For x = 1 To 5
        Debug.Print "Value of x is: "; x
    Next x
End Sub

5. Error Handling

An effective way to handle errors in VBA is to use the On Error statement. One approach is to use On Error Resume Next, which skips errors. Another approach is On Error GoTo, where you define a label and write your error handler there.

Sub TestErrorHandling()
    On Error GoTo ErrorHandler
    Dim x As Integer
    Dim y As Integer
    y = 0
    x = 1 / y
    Exit Sub
ErrorHandler:
    If Err.Number = 11 Then
        MsgBox "Division by zero error"
    End If
    Resume Next
End Sub

In this unit, we've covered fundamental techniques that are especially relevant for quality assurance and testing of a VBA application. You can adapt and extend these techniques as per your specific use-case. Remember, the key aim of these activities is to ensure that your Excel application functions as expected and delivers reliable outputs to the end-users.

Mastering Excel Functions, Formulas, and VBA

The focus is on the understanding and implementation of Excel functions and formulas, as well as Excel's Visual Basic for Applications (VBA) within the context of a Power BI project.

1. Excel Functions and Formulas

Excel functions and formulas are a powerful way to manipulate and analyze your data. We will be using the “IF” function and “SUM” function in an example here.

Using IF function

Let's pretend we have a sample sales data. We want to add another column, "Sales Status" that would mark every sales over 5000 as "High" and the rest as "Medium". The implementation of this in Excel would be as follows:

=IF(B2>5000,"High","Medium")

Using SUM function

Assume we have individual sales data for each month, but we want to calculate the total sales for the year.

=SUM(B2:M2)

2. VBA in Excel

VBA is a powerful feature in Excel that allows for automation of tasks and overall taking Excel's capabilities to the next level.

Automatically Update a Cell Value

We are going to create a macro that updates cell A1 with the current date and time every time the Excel file is opened.

Script for the VBA code:

Private Sub Workbook_Open()

    Range("A1").Value = Now
    
End Sub

Loop through Data

This macro will go through all the cells in column A and change cells with 'High' to 'Medium'.

Sub ChangeStatus()

    Dim MyRange As Range, MyCell As Range
    
    Set MyRange = Sheets("Sheet1").Range("A1:A20")
    
    For Each MyCell In MyRange 
        If MyCell.Value = "High" Then 
            MyCell.Value = "Medium" 
        End If 
    Next MyCell 

End Sub

3. Interaction between Excel and Power BI

The Power BI integration is an essential step in ensuring seamless data transmission and visualization.

Loading Data from Excel to Power BI

To load the Excel data (after applying the formulas and VBA codes) into Power BI, follow these steps:

  1. Open Power BI Desktop.
  2. Click on "Home" > "Get Data" > "Excel".
  3. Navigate and select the Excel workbook and then click "Open".
  4. In the Navigator window, select the sheet that contains your data and then click "Load".

Refresh Power BI with Updated Excel Data

Once we have the Excel data loaded into Power BI, it wouldn’t automatically update when the source Excel file is updated. To update it, you’d have to:

  1. Open the related Power BI file.
  2. Click "Home" > "Refresh" or press "Ctrl + R".

Sources

  • Excel, Microsoft. "IF function." docs.microsoft.com.
  • Excel, Microsoft. "SUM function." docs.microsoft.com.
  • Power BI, Microsoft. "Power BI service–basic concepts." docs.microsoft.com.
  • Excel, Microsoft. "Create a Macro." support.microsoft.com.

19. Applications Deployment and User Training

Application Deployment

The application deployment phase creates a launch-ready application bundle. In the context of Power BI reports and dashboards, it involves preparing the Power BI workspace and sharing the report to intended users. While VBA applications and any Excel associated files can be distributed through SharePoint or any secured data sharing platform.

Power BI Deployment

  1. Create a workspace in Power BI Service:
    1. On the Power BI Service home page, click Workspaces > Create a workspace.
    2. Fill in workspace information and save.
  2. Publish the Power BI Desktop report to the workspace:
    1. In Power BI Desktop, go to File > Publish > Publish to Power BI.
    2. Sign in with an account that has permissions to the target workspace.
    3. Select the workspace and click Publish.
  3. Once the report is published, it can be shared with users:
    1. In Power BI Service, go to the workspace.
    2. Click the ellipsis (...) next to the report > Share.
    3. In the Share dialog, enter user/group details, set permissions, and click Share.

VBA Application (Excel Files) Deployment

  1. Store the Excel file containing the VBA application in a SharePoint document library.
    1. From your SharePoint site, go to the Documents application and click New > Folder to create a new folder for your application.
    2. Once created, click Upload > Files, and choose your Excel file.
    3. Have users who need access to the VBA Application download the Excel file from SharePoint.

User Training

User training is necessary for end-users to understand how to use the deployed applications properly. In context with the Power BI and VBA application, give users a walkthrough of the application usage and operation.

Power BI User Training

  1. Introduction to Power BI report interface:
    1. Conduct a video session to explain Power BI navigation, data view, report view, and different visualization panels.
    2. Explain how to use the filters pane to filter the report data.
  2. Using the Power BI report:
    1. Provide a step-by-step walkthrough of how to access and use the published report in Power BI Service.
    2. Teach users how to access the report from their shared list, how to interact with the report, and if applicable, how to use the report's built-in dashboard features.

Excel/VBA Application User Training

  1. Basic Excel usage:
    1. If necessary, explain the basics of Excel to the users, including navigation, basic formulas, and data entry.
  2. VBA application usage:
    1. Show users how to access the VBA application from the Excel file downloaded from SharePoint.
    2. Explain the functionality and features of the VBA application, and how they fit into their workflow.
    3. Provide instructions on how to run the VBA application, how to input data, and how to interpret the results.

Providing user manuals and cheat sheets for them to have a quick reference when they forget something can be also very effective. It's important to continually follow up with users to address any emerging issues.

20. Project Closure, Reporting, and Feedback Collection

A. Power BI Dashboard Reporting

At the closure phase of the project, you'll need to gather your work into a final report. Using Power BI, create a dashboard that visualizes project-related data such as the number of tasks completed, hours worked, and other key performance metrics. Below a simple code snippet to demonstrate the data loading process into Power BI.

// Load data from the project's SharePoint list
let
    Source = SharePoint.Tables("https://sharepointurl.com", [ApiVersion = 15]),
    ProjectData = Source{[Item="ProjectData"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(ProjectData,{{"Name", type text}, {"Value", Int64.Type}})
in
    #"Changed Type"

Position the visualizations in a meaningful order and distribute this report to all team members and stakeholders.

B. VBA Project Finalization

After ensuring that all components of your VBA application are working as expected, properly comment your VBA code for future references. Here's a sample of lines of code with comments:

Sub CommentedCode()
  ' Define variables
    Dim ws As Worksheet
    Set ws = Worksheets("ProjectData")
    
  ' Loop through each row
    For R= 2 To ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
        ' Check if task completion status is Yes
        If ws.Cells(R, "B").Value = "Yes" Then
            ' Highlight completed tasks
            ws.Cells(R, "A").Interior.Color = RGB(0, 255, 0)
        End If
    Next R
End Sub

After adding suitable comments, it's recommended to store the final version of your VBA application in a version control system like Git.

C. Collection of Feedback

You can leverage Power Apps to create a simple, interactive feedback collection form.

// Name: TextInput1 ---- For taking user name
// Name: TextInput2 ---- For collecting feedback

Button:
    Text: "Submit Feedback"
    OnSelect: 
      Patch(
        '[dbo].[Feedback]', 
        Defaults('[dbo].[Feedback]'), 
        { Name: TextInput1.Text, Feedback: TextInput2.Text}
      )

Here, user inputs will be stored in a database table named Feedback. You can then analyze the feedback using Power BI to produce key learnings and find areas for improvements.

D. Archiving Project Data

Archive all project data for future references. Since you have integrated your project with SharePoint, it's recommended to create a new folder and move all project-related items to it.

// Create a new automating process in Power Automate
// Select SharePoint for the connector and select "Create new folder" action
// Add the SharePoint Site Address and the Folder Path

After this, create an automation process to move items to the new folder:

// In Power Automate
// Select SharePoint for the connector
// Use the "Move file" action which needs: Site Address, File Id (Actual file to be moved), Destination Id (Folder Id created previously).

You've now successfully closed, reported, and gathering feedback for your project!