Automating Inventory Management with Power BI and Process Automation
Description
This project aims to streamline the inventory reporting process by creating an automated system using Power BI. The system will leverage inbox CSV data, historical purchase data, and process automation to generate actionable reports. It will identify problematic vendors, manage inventory levels, and maintain service levels, all while ensuring minimal manual intervention. The project will also include functionality for projecting purchases, managing promotion notes, and communicating with leadership teams effectively.
The original prompt:
I'm looking to automate my inventory reporting I get updated daily inventory data landed in my inbox inside of outlook every morning in a CSV file what we are looking to do is to identify the problem vendors the ones that are slightly above we have too much inventory or whatever and we're looking to lower our overtop all inventory levels the other thing that we need to keep in close consideration is service levels so basically twice a week we send a report to our leadership team of our inventory levels we also need to project our purchases and what will receive for the rest of the month so right now what I'm trying to do is use power BI to automate all this but where some of the data needs to come out of daily Excel files because I don't have access to the back end SQL database I only have what they've already parked in power BI for me which does contain you know our historical purchases and data but it doesn't contain real time inventory and it doesn't contain expected purchase order dates it could be possible that we calculate lead times inside of there but they don't have our receipt data either so what I'm really looking to figure out is what are the kind of custom tables that I need to build and how can I automate the inventory and the other possible csp's from my email which are just exports from our ERP into a report that I don't have to update and dig through all the time and also we can add notes for other vendors that we are looking to say we're running a clearance promotion on this vendor or I'm working with the sales team to unload this stock
For an output I'm really looking for the project plan recommended path forward we have Microsoft Power BI have access to a lot of fabric power apps I don't have a premium license I don't think but I can get in there and most other Microsoft 365 products and power apps
Daily Email Integration and Data Import
Introduction
This section covers the practical implementation of automating daily email integration and data import into Power BI. This includes setting up the email system to receive data, extracting attachments, and loading data into Power BI for further analysis.
Setup Instructions
Email Integration
Create an Email Account:
- Use a corporate or dedicated email account for receiving inventory reports.
Configure Email Settings:
- Ensure the email account supports IMAP/SMTP protocols.
Process Automation
- Automate Email Retrieval and Attachment Extraction:
- Use Power Automate to create a flow that retrieves email attachments.
Power Automate Flow Steps
Trigger - When a New Email Arrives:
- Set up the trigger in Power Automate to monitor the inbox for new emails.
Condition - Check for Attachments:
- Add a condition to check if the email contains attachments.
Action - Save Attachments:
- Define action to save attachments to a designated OneDrive or SharePoint folder.
Trigger: "When a new email arrives"
Condition: "Email contains attachments == true"
Action: "Save attachment to OneDrive / SharePoint"
Destination:
Data Import
- Load Data into Power BI:
- Configure Power BI to import data from the saved attachments. This is a recurring process to ensure daily updates.
Steps for Power BI:
Get Data:
- Open Power BI Desktop and go to
Home
>Get Data
.
- Open Power BI Desktop and go to
Select Data Source:
- Choose
OneDrive
orSharePoint Folder
as your data source.
- Choose
Connect:
- Authenticate and navigate to the folder where attachments are saved.
Load Data:
- Select the relevant files and load them into Power BI.
Transform Data:
- Use Power Query to clean and transform data as required.
Create Visualizations:
- Build your inventory report visualizations based on the imported data.
Power BI - Load Data:
1. Home > Get Data > SharePoint Folder / OneDrive
2. Connect and navigate to the folder
3. Select files and load them
4. Use Power Query for data transformation
5. Create inventory visualizations
Conclusion
By following these steps, you will automate the process of receiving daily inventory reports via email, extracting attachments, and importing data into Power BI for analysis. This ensures seamless and efficient data integration, saving time and reducing manual efforts.
Building Custom Tables and Data Models for Automating Inventory Reporting
Step 1: Define the Data Model in Power BI
To build custom tables and data models in Power BI, you'll need to define the schema of your data model. This involves specifying tables, relationships, and measures.
1.1 Define Tables
Define the tables with required columns. Examples of tables may include Inventory
, Transactions
, Suppliers
, etc.
Example
Table: Inventory
Columns:
- ItemID (Primary Key)
- ItemName
- Category
- StockQuantity
- ReorderLevel
Table: Transactions
Columns:
- TransactionID (Primary Key)
- ItemID (Foreign Key)
- Quantity
- TransactionDate
- TransactionType (IN/OUT)
Table: Suppliers
Columns:
- SupplierID (Primary Key)
- SupplierName
- ContactNumber
Step 2: Create Relationships Between Tables
Establish relationships between tables in Power BI to create a cohesive data model.
Example
Inventory.ItemID
(One) <--->Transactions.ItemID
(Many)Suppliers.SupplierID
(One) <--->Inventory.SupplierID
(Many)
Step 3: Load Data
Use the Power BI interface to import data into Power BI from various data sources like SQL Server, Excel, etc.
Step 4: Define Calculated Columns and Measures
Create calculated columns and measures to enhance the data model.
Example
Calculated Column: Total Stock Value
TotalStockValue = [StockQuantity] * RELATED(Transactions.Price)
Measure: Current Stock
CurrentStock = SUM(Inventory[StockQuantity])
Measure: Items to Reorder
ItemsToReorder = COUNTROWS(
FILTER(Inventory, Inventory[StockQuantity] < Inventory[ReorderLevel])
)
Step 5: Automate Data Refresh
Set up a scheduled refresh in Power BI to ensure that your data is automatically updated.
Example
- Go to the
Datasets
section. - Select
Schedule Refresh
. - Configure the refresh frequency and time.
Step 6: Email Integration for Reporting
Integrate with a process automation tool like Microsoft Power Automate to send daily or weekly reports via email.
Example
- Create a new flow in Power Automate.
- Use the
Power BI
connector to automate sending reports. - Set the trigger for the flow (Scheduled, e.g., daily at 8 am).
- Add actions to
Get Data
from Power BI andSend an Email
with the data.
Power Automate Pseudocode:
Trigger: Recurrence (Daily at 8 am)
Actions:
- Power BI: Export Data (Export your inventory report dataset)
- Email: Send an Email
- To: [Recipients]
- Subject: "Daily Inventory Report"
- Body: Attach the exported data
Conclusion
Implement the above steps to build custom tables and data models in Power BI for your inventory reporting automation project, integrating with process automation tools for seamless email reporting.
Automating Inventory Reporting with Power BI
Overview
This part will focus on automating the creation and distribution of inventory reports in Power BI. We'll leverage Power BI's capabilities to generate reports and enable process automation to distribute these reports via email.
Creating & Automating the Report
Open Power BI Desktop:
- Ensure you have your data models and tables established from previous steps.
Create the Inventory Report:
- Use the Report View in Power BI Desktop.
- Drag and drop necessary fields and visualizations (e.g., tables, charts) to create a comprehensive inventory report. Format and design the report as required.
- Save the report once completed.
Publish to Power BI Service:
- In Power BI Desktop, click on "File" -> "Publish" -> "Publish to Power BI".
- Sign in with your organizational credentials and select the appropriate workspace to publish the report.
Power BI Service - Create and Configure a Dashboard:
- Navigate to Power BI Service and locate the published report.
- Create a new Dashboard and pin necessary report components (visualizations) to this dashboard.
Automating Report Refresh:
- Go to Datasets in Power BI Service.
- Select your published dataset associated with the inventory report.
- Configure the "Scheduled refresh" settings:
- Set the refresh frequency (daily, weekly, etc.).
- Enter your data source credentials if prompted.
Automating Email Distribution
Set Up Power Automate (formerly Microsoft Flow):
- Log into Power Automate.
- Create a new flow using a template or start from blank.
Trigger Flow Based on Dataset Refresh:
- Choose a trigger such as "When a data-driven alert is triggered" (available in Power BI connectors).
- Select the relevant workspace, dashboard, and the specific condition that should trigger the flow. For example, set an alert if inventory levels fall below a certain threshold.
- Choose a trigger such as "When a data-driven alert is triggered" (available in Power BI connectors).
Action: Export Report to PDF:
- Add an action to "Export a Power BI report to a file".
- Configure this action to export the report as a PDF file.
- Choose the workspace, report, and page as necessary.
Action: Send an Email with the Report:
- Add an action to "Send an email" (using Outlook or similar mail service).
- Configure the email settings:
- To: [List of recipients]
- Subject: "Automated Inventory Report"
- Body: "Please find attached the latest automated inventory report."
- Attach the exported PDF file from the previous action.
Save and Test the Flow:
- Save the Power Automate flow.
- Test the flow to ensure everything is working correctly by manually triggering the dataset refresh or alert condition.
By following these steps, your inventory reports will be automatically generated and distributed via email, ensuring timely communication and data-driven decision-making.
Conclusion
Utilizing Power BI and Power Automate, this implementation links data refresh in Power BI with automated email notifications, streamlining inventory reporting. This process ensures that relevant stakeholders receive up-to-date reports without the need for manual intervention.
Service Level Monitoring and Vendor Management Implementation
Service Level Monitoring
To monitor the service levels of vendors effectively and handle the data through Power BI, the following steps can be implemented:
Data Sources and Integration
- Database/Excel Sheet of Vendor Performance Metrics: Collect the data inputs such as service uptime, delivery performance, issue resolution times, and other relevant service performance metrics. Ensure this data is regularly updated and accessible.
Power BI Implementation
Loading Data:
- Load the vendor performance metrics dataset into Power BI. This can be achieved via the 'Get Data' option in Power BI, capable of connecting to various data sources (Excel, SQL Server, etc.).
Data Transformation:
- Use Power Query to clean, reshape, and transform the data to ensure it is in a suitable format for analysis. Transformations might include renaming columns, handling missing values, and creating calculated columns as needed.
DataSource = LoadData("VendorPerformanceMetrics") CleanedData = TransformData(DataSource, [ RenameColumns, HandleMissingValues, CreateCalculatedColumns ])
Creating Measures:
- Define key performance indicators (KPIs) as DAX (Data Analysis Expressions) measures.
ServiceUptime = DIVIDE(SUM(CleanedData[UptimeHours]), SUM(CleanedData[TotalHours])) DeliveryPerformance = DIVIDE(SUM(CleanedData[OnTimeDeliveries]), SUM(CleanedData[TotalDeliveries]))
Visualizing Data:
- Create Power BI dashboards and reports to visualize these KPIs. Use bar charts, line graphs, and KPI cards to display service levels over time.
Dashboard.AddChart(ChartType.Line, CleanedData, Measure.ServiceUptime, TimePeriod.Month) Dashboard.AddChart(ChartType.Bar, CleanedData, Measure.DeliveryPerformance, Vendors)
Vendor Management
To manage vendor-related tasks, the following process automation steps can be set up:
Process Automation
Automating Alerts and Notifications:
- Set up automated alerts using Power Automate when KPIs fall below the defined thresholds. For example, if service uptime falls below 99%, send an email notification to the vendor and relevant stakeholders.
Flow.Trigger = WhenKPIDropsBelowThreshold(KPI.ServiceUptime, 0.99) Flow.Action = SendEmail("vendor@example.com", "Service Uptime Alert", "Your service uptime has fallen below 99%. Please take corrective actions.")
Email Integration:
- Use Power Automate to schedule regular performance summary emails to vendors, providing them with insights into their monthly performance and areas of improvement.
Flow.Trigger = ScheduleTime("Monthly", "FirstDayOfMonth") Flow.Action = SendEmail( "vendor@example.com", "Monthly Performance Summary", GeneratePerformanceSummaryEmailBody(CleanedData) )
function GeneratePerformanceSummaryEmailBody(data): return "Your monthly performance metrics are as follows: \n" + "Service Uptime: " + Format(data.ServiceUptime, "Percent") + "\n" + "Delivery Performance: " + Format(data.DeliveryPerformance, "Percent") + "\n" + "Please review and take necessary actions."
Vendor Dashboard (Power BI)
Create a dedicated vendor management dashboard that includes:
- Performance trend analysis over time.
- Comparative analysis between different vendors.
- Detailed breakdowns of specific issues and areas for improvement.
VendorDashboard.AddChart(ChartType.Line, CleanedData, Measure.ServiceUptime, TimePeriod.Month, ["VendorA", "VendorB"]) VendorDashboard.AddChart(ChartType.Bar, CleanedData, Measure.DeliveryPerformance, ["VendorA", "VendorB"]) VendorDashboard.AddTable(CleanedData, Columns=[VendorName, IssueResolutionTimes, LateDeliveries])
By implementing the above steps, you can monitor service levels and manage vendor performance effectively using Power BI and process automation. This will ensure proactive decision-making and enhance vendor relationships.
Generating Projections and Communicating Results
Introduction
This section focuses on generating projections using Power BI and communicating the results through automated reporting and email integration.
Steps for Implementation:
1. Creating Projections in Power BI
a. Calculate Forecasts
- Use DAX (Data Analysis Expressions) to create custom measures for projections. Here’s an example to calculate projected sales:
ProjectedSales =
CALCULATE(
SUM(Sales[ActualSales]),
DATESINPERIOD(
Sales[Date],
MAX(Sales[Date]),
30,
DAY
)
) * 1.1 -- Adjust the multiplier based on historical data or trend analysis
b. Apply Time Series Analysis
- Implement a moving average for smoother projections:
MovingAverage3Months =
CALCULATE(
AVERAGEX(
DATESINPERIOD(
Sales[Date],
MAX(Sales[Date]),
-3,
MONTH
),
[ProjectedSales]
)
)
2. Create Visuals in Power BI
Utilize Power BI's visualization capabilities to create charts and graphs showing projections:
- Line Charts: Ideal for trend analysis.
- Bar Charts: Useful for comparing projected and actual sales.
- Scatter Plots: Helps in identifying anomalies and correlations in projections.
In Power BI Desktop:
- Go to the 'Visualizations' pane.
- Select the desired visual (e.g., Line Chart).
- Drag and drop the fields (e.g., Date to Axis, ProjectedSales to Values).
- Customize the chart using the 'Format' pane.
3. Automating the Report
a. Create/Update a Power BI Report
- Create a report page specifically for projections and ensure it updates automatically with the latest data.
b. Publish to Power BI Service
- Save your Power BI report (.pbix file) in Power BI Desktop.
- Click on 'File' -> 'Publish' -> 'Publish to Power BI'.
- Select your workspace and publish.
4. Communicate Results via Email
a. Set Up a Power Automate Flow
- Use Power Automate to send emails with the latest projections.
- Go to Power Automate.
- Create a new Flow: 'Scheduled Flow'.
- Define trigger (e.g., daily at 8 AM).
- Add a new action: 'Get rows' to fetch the latest data from Excel/SQL.
- Add another action: 'Send an email' using Office 365 Outlook connector.
- Customize the email body to include key data points/numbers.
- Attach a snapshot of the Power BI report (if needed): a. Export the visual as a static image using Power BI REST API. b. Attach the image in the email.
Example JSON Body for Email (within Power Automate)
{ "to": "your.email@example.com", "subject": "Daily Inventory Projections Report", "body": "
Daily Report
Find attached the latest projections.
", "attachments": [ { "contentBytes": "{Base64EncodedImage}", "name": "Projections.png", "contentType": "image/png" } ] }Conclusion
You have now set up Power BI to generate projections and automated the communication of these results through emails. This ensures stakeholders receive timely and accurate forecasts.Tabs(labels)