| title | Data Warehouse Tutorial: Create a Query with the Visual Query Builder in a Warehouse |
|---|---|
| description | In this tutorial, learn how to create a query with the visual query builder. |
| ms.reviewer | scbradl |
| ms.date | 04/06/2025 |
| ms.topic | tutorial |
Applies to: [!INCLUDE fabric-se-and-dw]
In this tutorial, learn how to create a query with the visual query builder.
Note
This tutorial forms part of an end-to-end scenario. In order to complete this tutorial, you must first complete these tutorials:
In this task, learn how to create a query with the visual query builder.
-
Ensure that the workspace you created in the first tutorial is open.
-
On the Home ribbon, open the New SQL query dropdown list, and then select New visual query.
:::image type="content" source="media/tutorial-visual-query/ribbon-new-visual-query.png" alt-text="Screenshot of the Home ribbon, highlighting the New visual query option." lightbox="media/tutorial-visual-query/ribbon-new-visual-query.png":::
-
From the Explorer pane, from the
dboschema Tables folder, drag thefact_saletable to the visual query canvas.:::image type="content" source="media/tutorial-visual-query/drag-drop-table.png" alt-text="Screenshot of the Explorer pane, highlighting the fact sale table to drag to the visual query canvas.":::
-
To limit the dataset size, on the query designer ribbon, select Reduce rows > Keep top rows.
:::image type="content" source="media/tutorial-visual-query/keep-top-rows.png" alt-text="Screenshot of the Reduce rows dropdown, highlighting the Keep top rows option.":::
-
In the Keep top rows window, enter
10000, and then select OK. -
From the Explorer pane, from the
dboschema Tables folder, drag thedimension_citytable to the visual query canvas. -
To join the tables, on the query designer ribbon, select Combine > Merge queries as new.
:::image type="content" source="media/tutorial-visual-query/merge-queries-new.png" alt-text="Screenshot of the Combine dropdown, highlighting the Merge queries as new option.":::
-
In the Merge dialog, complete the following settings:
-
In the Left table for merge dropdown list, select
dimension_city. -
In the following grid, select the
CityKeycolumn. -
In the Right table for merge dropdown list, select
fact_sale. -
In the following grid, select the
CityKeycolumn. -
In the Join kind section, select Inner.
:::image type="content" source="media/tutorial-visual-query/merge-settings.png" alt-text="Screenshot of the Merge dialog, highlighting the settings.":::
-
-
Select OK.
-
In the data preview pane, locate the
fact_salecolumn (the last column).:::image type="content" source="media/tutorial-visual-query/data-preview-fact-sale-column.png" alt-text="Screenshot of the data preview pane, highlighting the fact sale column.":::
-
In the
fact_salecolumn header, select the Expand button.:::image type="content" source="media/tutorial-visual-query/data-preview-fact-sale-column-expand.png" alt-text="Screenshot of the data preview pane, highlighting the fact sale column expand button.":::
-
In the column selector dialog, select only these three columns:
TaxAmount,Profit, andTotalIncludingTax.:::image type="content" source="media/tutorial-visual-query/merge-column-selection.png" alt-text="Screenshot of the merge column selection, highlighting the selection of Tax Amount, Profit, and Total Including Tax.":::
-
Select OK.
-
To aggregate the dataset, on the ribbon, select Transform > Group by.
:::image type="content" source="media/tutorial-visual-query/transform-group-by.png" alt-text="Screenshot of the Transform dropdown, highlighting the Group by option.":::
-
In the Group by dialog, complete the following settings:
-
In the three Group by dropdowns, set the following options:
CountryStateProvinceCity
-
In the New column name box, enter the name
SumOfTaxAmount.- In the Operation dropdown list, select Sum.
- In the Column dropdown list, select
TaxAmount.
-
Select Add aggregation.
-
Set the aggregation as follows:
- New column name:
SumOfProfit - Operation: Sum
- Column:
Profit
- New column name:
-
Add another aggregation, and set the aggregation as follows:
- New column name:
SumOfTotalIncludingTax - Operation: Sum
- Column:
TotalIncludingTax
- New column name:
:::image type="content" source="media/tutorial-visual-query/group-by-settings.png" alt-text="Screenshot of the Group by dialog, highlighting the settings.":::
-
-
Select OK.
-
Review the query result in the data preview pane.
:::image type="content" source="media/tutorial-visual-query/data-preview-final-result.png" alt-text="Screenshot of the final query result, showing three grouping columns, and three summarized columns." lightbox="media/tutorial-visual-query/data-preview-final-result.png":::
-
Rename the query, right-click on the query tab, and then select Rename.
:::image type="content" source="media/tutorial-create-tables/rename-query-option.png" alt-text="Screenshot of the Refresh option available when right-clicking the query editor tab." border="false":::
-
In the Rename window, replace the name with
Sales Summary, and then select Rename.
[!div class="nextstepaction"] Tutorial: Analyze data in a notebook