
Image by Editor | Midjourney
Creating statistical reports manually in Excel can be time-consuming. Repetitive tasks lead to errors and wasted effort. Power Query helps automate data imports, cleaning, and transformations. With just a few clicks, you can refresh reports with the latest data.
In this article, we will show how to use Power Query to streamline your statistical reporting process.
What Is Power Query?
Power Query is a data connection technology that enables you to connect, combine, and refine data. It’s commonly used in Microsoft Excel and Power BI to import, clean, and transform data without writing complex code.
Key features of Power Query:
- Data Import: Pull data from multiple sources like databases, Excel files, web pages, CSV files, and cloud services.
- Data Transformation: Clean, filter, merge, and shape data to fit your analysis.
- Automation: Save data transformation steps and refresh the data automatically when the source data changes.
Now, we will discuss the steps to automate statistical reports in Excel.
Prepare Your Data Source
Ensure your raw data (e.g., sales, survey, or experiment results) is consistently structured. Power Query works best when column headers and data formats are uniform.
The sales data includes columns for region, country, item type, sales channel, units sold, unit price, unit cost, total revenue, total cost, and total profit.
Load Data into Power Query
To start, follow these steps:
- Open Excel and navigate to the Data tab.
- Click Get Data and select the appropriate data source.
- Choose Transform Data to open the Power Query Editor.

Clean and Transform the Data
Once in the Power Query Editor, you can prepare your data by:
- Remove unnecessary columns by right-clicking and choosing Remove Columns.
- Filter out irrelevant rows using the dropdown arrows in the column headers.
- Rename columns for clarity by double-clicking the column headers.
- Change data types to ensure consistency across your dataset.
- Use the Group By feature to summarize data based on categories.
- Add custom columns with calculated values using the Add Column > Custom Column option.
- Apply transformations such as pivoting, unpivoting, or splitting columns.

We changed the data type of Total Profit from decimal to whole number. Then, we filtered the Sales Channel to include only offline channels. Finally, we added a new column to calculate the profit margin by dividing Total Profit by Total Revenue.
Load Data Into Excel
After transforming your data, you have options to load it back into Excel:
- Click “Close & Load”: This default option loads the transformed data into a new worksheet as a structured Excel table.
- Choose “Close & Load To…”: This gives you several loading choices such as Table, PivotTable Report, PivotChart, or creating only a data connection.

Create Your Statistical Report
Once your cleaned and transformed data has been loaded into Excel, you can build your statistical report.
- Use PivotTables to create statistical summaries.
- Use Excel formulas like STDEV.P, AVERAGEIF, etc., on Power Query tables.
- Create visual dashboards using charts and slicers connected to your data.

This pivot table and chart display the sum of total profit for several product categories across different geographical regions.
Automate with Refresh
Whenever your source data is updated, you can:
- Click Data > Refresh All to update your entire report automatically.
- For full automation, use a Workbook_Open VBA macro to refresh on file open.
- Alternatively, schedule automatic refreshes with Power Automate.

Best Practices
To maximize the effectiveness of your Power Query workflows, keep these tips in mind:
- Use descriptive names for queries and columns to clarify their purpose.
- Document transformation steps by adding comments for better collaboration.
- Test your queries on sample data to identify issues early.
- Keep queries modular by breaking complex processes into smaller parts.
Wrapping Up
Power Query simplifies the process of creating and updating statistical reports in Excel. It automates tasks like cleaning and transforming data, saving time and reducing errors. You get more accurate results with less manual work. Once you set it up, you can update your reports with a single click whenever new data arrives. You can also configure it to refresh automatically.

i cliked 50 tabs but data is stil left