How to Add a New Query in Power BI
Adding a new query is the first and most fundamental step in any Power BI project. It's how you tell Power BI where to find your data, whether it's buried in an Excel file, a cloud database, or a web page. This tutorial will walk you through several ways to add new queries, from the most basic methods to more advanced techniques that will save you a ton of time.
What Exactly is a Query in Power BI?
Think of a query as a recipe that Power BI follows to get and prepare your data. When you connect to a data source, Power BI creates a query. This query records a series of steps: where the data comes from (the source), how to clean it up (like removing empty rows), and how to transform it (like changing text to numbers). Every table you see in your final report started as a query.
All of this work happens in a special tool called the Power Query Editor. It's the engine room of Power BI where you shape your raw data into something clean, organized, and ready for analysis. Understanding how to create and manage queries here is an essential skill for building useful and reliable reports.
Method 1: The Standard Way - Using 'Get Data'
The most straightforward way to create your first query is from the main Power BI Desktop window. This is usually where every project begins.
Here’s the step-by-step process:
- Find the 'Get Data' Button: On the Home tab of the Power BI ribbon, you'll see a prominent "Get Data" button. Click on it.
- Choose Your Data Source: A drop-down menu with common data sources (like Excel workbook, SQL Server, Text/CSV) will appear. If you don't see yours, click "More..." at the bottom to open a full window showcasing the hundreds of available connectors.
- Browse the Connector Library: The sources are organized by category, such as File, Database, Power Platform, Azure, and Online Services. For this example, let's select Excel workbook and click Connect.
- Select Your File: A file browser will open. Navigate to your Excel file, select it, and click Open.
- The Navigator Window: Power BI will then show you the "Navigator" window. This pane displays all the available sheets and tables within your Excel file. Click on the item you want to import - you’ll see a preview on the right.
At this point, you have a crucial choice:
- Load: Clicking "Load" skips the Power Query Editor for now and pulls the data directly into your data model as-is. You can always go back and edit the query later. Best for data you know is already perfectly clean.
- Transform Data: This is the option you'll use 90% of the time. Clicking "Transform Data" opens the Power Query Editor, where your new query appears. It's here that you can start cleaning, shaping, and transforming your data before loading it into your model.
Choosing "Transform Data" officially creates the query and takes you directly to the Power Query Editor, ready for the next steps.
Method 2: Adding Queries Directly from the Power Query Editor
Once you're already working inside the Power Query Editor, you don't need to close it to add more data. You can bring in additional sources directly, which is useful when your project requires data from multiple places.
For example, you might have your main sales data in an Excel file, but customer details are in a CSV file, and product categories are on a web page. You can add queries for all of these from one central place.
How to Add a New Source in Power Query
- Navigate to the Home Tab: Inside the Power Query Editor, make sure you are on the "Home" ribbon.
- Click 'New Source': Towards the left side of the ribbon, you'll find a "New Source" button.
- Select Your Source: It works just like the "Get Data" button in the main window. Clicking it shows you a list of common sources, and you can click "More..." to see the full library.
- Connect and Load: Follow the same steps as before to connect to your new data source. Once you do, the new query will appear in the Queries pane on the left, right below your existing ones.
This is the standard workflow for building a report that combines multiple datasets. You add each source one by one inside the Power Query Editor, clean them up, and then you can start merging or appending them as needed.
Method 3: Advanced Ways to Create Queries from Existing Ones
Sometimes, the data you need is already inside Power BI in another query. Instead of starting from scratch, you can use existing queries as a foundation for new ones. This is a massive time-saver and helps keep your work consistent and organized.
These actions are performed in the Queries pane on the left side of the Power Query Editor.
Duplicating a Query
Duplicating creates an exact, independent copy of an existing query, including all its applied transformation steps.
- How to do it: Right-click on the query you want to copy and select Duplicate.
- Why it's useful: Duplication is perfect for when you need to create two similar but slightly different tables. For instance, you could have an initial query called "All Sales Data" with 20 cleaning steps. You could then duplicate it twice, naming the copies "US Sales" and "EU Sales," and simply add one final filtering step to each copy. This saves you from having to repeat those first 20 steps manually. Since the copies are independent, changes to one won't affect the other.
Referencing a Query
Referencing creates a new query that is dependent on the original. It essentially means the new query starts with the final output of the source query.
- How to do it: Right-click on the query you want to base the new one on and select Reference.
- Why it's useful: This is one of the most powerful features for organization. You can create a "base" query where you perform all the major data cleaning (e.g., removing errors, setting data types, handling nulls). Then, you reference that base query multiple times to create your final tables for reporting (e.g., "Sales by Region," "Sales by Date," "Product Summary"). The key benefit? If you ever discover a mistake in the base query and fix it, that fix automatically flows down to all the dependent, referenced queries. This avoids having to make the same change in five different places.
Creating a Blank Query
For more advanced users, you can create a query from an empty slate, which lets you write or paste in your own Power Query M formula language code. This is great for custom functions, manual data entry, or programmatic-style transformations.
- How to do it: In the Power Query Editor, go to Home > New Source > Blank Query.
- What it's for: A Blank Query opens with just a source step. You can click on "Advanced Editor" from the Home tab and write M code directly. For example, you could create a simple list of dates for a calendar table or pull data from an API using an M language function. Here's a tiny example of M code you could paste into the advanced editor to create a simple two-column table from scratch:
let
Source = #table(
{"ProductID", "ProductName"},
{
{101, "Widget A"},
{102, "Widget B"},
{103, "Widget C"}
}
)
in
SourceMethod 4: Queries Created by Combining Other Queries
You can also generate new queries by combining existing ones. The "Combine" section on the Power Query ribbon gives you two main options that both result in a new, third query.
Append Queries
Appending stacks data from multiple queries on top of each other. Think of it as adding rows. For this to work well, the tables should have similar or identical column headers.
- Example: You have separate queries for sales from January, February, and March. You can append them together to create a single new query called "First Quarter Sales".
Merge Queries
Merging joins two queries side-by-side based on a matching column, similar to a VLOOKUP in Excel or a JOIN in SQL. This adds new columns to your data.
- Example: You have a query with Sales data that includes a
ProductIDcolumn, and a separate "Product Lookup" query that hasProductIDandProductName. You can merge them using theProductIDkey to add theProductNameto your sales table in a new query.
Best Practices for Managing Your New Queries
As you add more queries, your project can get cluttered quickly. Here are a few tips to stay organized:
- Rename Everything: As soon as you create a query, give it a clear, descriptive name. "Source1" or "Table 1" is not helpful. Change it to something meaningful like "Campaign_Performance_FB" or "Sales_Data_2024".
- Use Groups: In the Queries pane, you can right-click and "Move to Group" to create folders. This lets you organize your queries into logical sections like "Data Sources," "Staging Queries," and "Report Tables". For complex projects, this is non-negotiable.
- Disable Load for Helper Queries: Not every query needs to be loaded into your final data model. Often, you have intermediate queries used for staging or merging. For these, you can right-click the query and uncheck "Enable load." This keeps your final model lean while still using the query in the background.
Final Thoughts
Mastering how to add and manage new queries is the bedrock of building effective reports in Power BI. Whether you're using the simple 'Get Data' dialog, referencing other queries for efficiency, or combining sources, these techniques give you full control over how your data flows into your dashboards. Each new query you create is another building block in your analysis.
Of course, this process requires learning the ins and outs of a tool like Power BI and manually connecting each data source and cleaning it up step-by-step. If you just need to get fast answers from your business data without a steep learning curve, we built Graphed to simplify all of this. Instead of hunting for connectors and transforming data, you just securely connect your platforms like Google Analytics, Shopify, or Facebook Ads in a few clicks. From there, you can ask for reports and dashboards in plain English, and our AI builds them for you in seconds.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?