How to Export Data from Power BI to SQL Server
Your Power BI dashboard looks great, filled with valuable insights pulled from various sources. But now you need that processed, cleaned, and aggregated data in a SQL Server database for long-term storage, ad-hoc analysis, or to feed another application. This article will walk you through several practical methods for exporting your data from Power BI directly into SQL Server.
Why Export Data from Power BI to SQL Server?
Before jumping into the "how," let's quickly cover the "why." While Power BI is a phenomenal tool for visualization and interactive analysis, it's not a database. There are several common reasons why you might need to move your data from a Power BI dataset into a SQL Server environment:
- Data Warehousing & Archiving: You might want to store historical snapshots of your data in a permanent, structured database. A Power BI dataset might get refreshed, but a SQL database can hold that data for historical trend analysis years down the line.
- Integration with Other Systems: Other applications, custom scripts, or internal tools may need access to the data you've modeled in Power BI. A SQL database is a universal access point for these systems.
- Advanced SQL Queries: DAX is powerful, but sometimes you just need the flexibility and power of SQL for complex, multi-table joins, intricate window functions, or other operations that are simpler to write in SQL.
- Backup and Redundancy: Keeping a copy of your curated, transformed data in SQL Server provides an extra layer of backup. If something happens to your report or dataset, you still have the underlying data securely stored.
Method 1: The Manual Approach - Using Export Data to CSV
The most straightforward method for getting data out of Power BI is the built-in export feature. This is ideal for one-off tasks or when you're working with smaller datasets and don't need an automated pipeline. The basic flow is to export data from a Power BI visual into a CSV file and then import that file into SQL Server.
Step 1: Create a Table Visual in Power BI
The "Export data" functionality works on a per-visual basis. The best practice is to create a visualization that contains exactly the data you want to export.
- On your Power BI report canvas, add a Table or Matrix visual.
- Drag all the columns and measures from your dataset (the fields you want to export) into the "Values" or "Columns" section of the visual.
- Ensure the table is displaying the data exactly as you need it. Remove any grand totals or subtotals you don't want in your final SQL table.
Step 2: Export the Data
Once your table visual is prepared:
- Hover over the visual and click the ellipsis (...) in the top-right corner.
- Select Export data.
- You'll likely see two options:
- Choose Summarized data and select the .CSV format for the easiest import into SQL Server. Save the file to your machine.
Keep in mind that Power BI has export limits. For a .CSV file, the limit is typically 30,000 rows from Power BI Desktop and Power BI services. For .XLSX files, it's 150,000 rows. If your dataset is larger, you'll need one of the other methods.
Step 3: Import the CSV into SQL Server
With your CSV file ready, you can easily import it using SQL Server Management Studio (SSMS).
- Open SSMS and connect to your database.
- In the Object Explorer, right-click on your target database.
- Go to Tasks > Import Flat File...
- The Import Flat File Wizard will launch. Click Next.
- Browse to and select your saved CSV file. The wizard will automatically suggest a table name (which you can change) and analyze the file to determine data types for each column.
- Review the column data types and make any necessary adjustments before proceeding.
- Click Finish. The wizard will create a new table and import all the data from your CSV file.
Method 2: The Power User's Friend - Using DAX Studio
If you're dealing with larger datasets or want to export entire tables without building a visual for them first, DAX Studio is an invaluable free tool. It connects directly to your Power BI data model and allows you to run DAX queries against it and export the results.
Step 1: Install and Connect DAX Studio
First, download and install DAX Studio from daxstudio.org. Once installed:
- Open the Power BI file (.pbix) you want to extract data from.
- Open DAX Studio. A "Connect" dialog box will appear.
- Select PBI / SSDT Model. DAX Studio should automatically detect your open Power BI file. Select it from the dropdown list.
- Click Connect.
Step 2: Write a DAX Query to Select Your Data
In the main DAX Studio query window, you'll write a simple query to retrieve the table you want. The keyword for this is EVALUATE.
For example, to get every single row and column from a table named SalesData, your query would be:
EVALUATE
'SalesData'If you want to pull data from a more complex model or select specific columns, you can use functions like SUMMARIZECOLUMNS:
EVALUATE
SUMMARIZECOLUMNS(
'Date'[Year],
'Product'[Category],
"Total Sales", SUM('Sales'[Sales Amount]),
"Total Profit", SUM('Sales'[Profit])
)Step 3: Export Directly to SQL Server
This is where DAX Studio shines. After running your query, go to the Output tab in the main menu and change the output destination from "Grid" to "SQL Server."
- You'll be prompted to enter your SQL Server name and authentication details.
- Enter a name for the new table where the exported data will be stored (e.g., PowerBI_Sales_Export).
- Click Export.
- Once your DAX query runs, the data will be sent directly from your Power BI model into the newly created table in your SQL Server database. No CSV file is needed. This method circumvents the row limits imposed by the Power BI service export feature.
Method 3: The Automated Approach - Using Power Automate
For users who need to sync data from Power BI to SQL Server on a recurring basis (e.g., every morning at 8 AM), Power Automate offers a robust solution for creating an automated pipeline. This method requires a Power Automate license that includes premium connectors since both the Power BI and SQL Server connectors are considered premium.
Step 1: Create a Scheduled Cloud Flow
In Power Automate (make.powerautomate.com), start by creating a new flow.
- Click Create > Scheduled cloud flow.
- Give your flow a name, like "Daily PBI to SQL Sync."
- Set your desired schedule, such as running once every day, and click Create.
Step 2: Run a Query Against a Power BI Dataset
In the flow editor, add a new action.
- Search for the Power BI connector.
- Select the action Run a query against a dataset.
- Select the Workspace and Dataset where your data lives.
- In the Query Text box, you must write a DAX query just like in DAX Studio. This query will define what data is returned. For example:
EVALUATE SUMMARIZECOLUMNS('Customers'[Customer Name], 'Sales'[Region], "Total Orders", COUNT('Sales'[Order ID]))Step 3: Insert Rows into SQL Server
The previous step will return a list of rows from your Power BI dataset. Now you need to insert them one by one into your SQL table.
- Add a new step and search for the SQL Server connector.
- Select the action Insert row.
- Set up your connection to your SQL Server and then choose the target table for the data. Note: The table must already exist in SQL Server for this to work.
- An Apply to each loop will automatically be created because the Power BI action can return multiple rows.
- In the Insert row action fields, map the Power BI outputs to your SQL table columns using the Dynamic content picker. For example, you would map
Customer Namefrom the Power BI dynamic content to the CustomerName column field in your SQL action.
Save and test your flow. It will now run on the schedule you defined, pulling fresh data from your Power BI dataset and populating your SQL Server table, creating a fully automated pipeline for your reporting needs.
Final Thoughts
As you can see, you have several options for moving data from Power BI to SQL Server, ranging from simple manual exports to fully automated pipelines. The right method depends on your data volume, technical comfort level, and whether you need the process to be automated.
Often, the friction involved in exporting data from reporting tools like Power BI reveals a deeper challenge: your data is scattered, and getting simple answers requires jumping between platforms. At Graphed, we experienced this firsthand and built a solution to solve it. We enable you to connect directly to all your source systems - like Google Analytics, Shopify, Salesforce, and your ad platforms - and bring everything into one place. Instead of spending hours building models in Power BI only to export them again, you can use simple natural language to create real-time dashboards and get answers in seconds, entirely bypassing the manual data wrangling.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.