This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
As a data engineer, it is important to be able to efficiently organize, analyze and derive insights from your data so that you can drive informed and data-driven decisions across your organization. Having a well set up Data Warehouse, you can ensure data integrity, improve your query performance and support advanced analytics. Optimizing a Data Warehouse empowers data engineers to overcome data silos and provide scalable infrastructure to meet evolving business needs.
Contoso Retailers, a fictious company, wants to learn how to optimize their Data Warehouse with the help of Copilot to gain insights into their Sales performance and make data driven decisions from these insights.
Contoso Retailers aims to optimize their Data Warehouse to analyze trends and patterns affecting their sales performance effectively. By leveraging Copilot, they intend to gain insights into their data, identify key drivers of sales fluctuations, and make more informed, data-driven decisions.
You can use Copilot for Data Warehouse for code completion, code explanation, code fixes, code generation and more.
Before you can build, manage a warehouse schema and load data, you need to create a Data Warehouse where your data will sit. You can learn more about Data Warehouses in Microsoft Fabric by referring to - How to create a Warehouse.
Example prompt: Add a table DimCustomer with the columns PersonID type BIGINT, FirtstName, LastName, Gender, Address, StoreID, TerritoryID, no primary key.
Screenshot_of_Microsoft_Fabric_Data_Warehouse_interface_showing_a_response_card
Example prompt: Add a table DimProducts with the columns ProductID type BIGINT, ProductCategoryName, Model, no primary key.
Example prompt: Add a table FactSales with the columns PersonID type BIGINT, ProductID, StoreID, OrderDate, OrderQty, UnitPrice, UnitPriceDiscount, GrossRevenue, NetRevenue, no primary key.
SQL Code example:
INSERT INTO DimCustomer (PersonID, FirstName, LastName, Gender, Address, StoreID, TerritoryID)
SELECT
p.PersonID,
p.FirstName,
p.LastName,
p.Gender,
p.Address,
d.StoreID,
d.TerritoryID
FROM LearningHub_LH.dbo.Person p
JOIN LearningHub_LH.dbo.DimCustomer d
ON p.PersonID = d.PersonID;
INSERT INTO DimProducts (ProductID, ProductCategoryName, Model)
SELECT
ProductID, ProductCategoryName, Model
FROM LearningHub_LH.dbo.DimProducts;
INSERT INTO FactSales (PersonID, ProductID, StoreID, OrderDate, OrderQty, UnitPrice, UnitPriceDiscount, GrossRevenue, NetRevenue)
SELECT
PersonID,
ProductID,
StoreKey,
OrderDate,
OrderQty,
UnitPrice,
UnitPriceDiscount,
Gross_Revenue,
Net_Revenue
FROM LearningHub_LH.dbo.Sales;
Note: You can replace LearningHub_LH with your Lakehouse name.
Using the same warehouse you can use Copilot for Data Warehouse to create views that will allow you to get a summary of your data.
SELECT
dd.Year,
dd.Month,
dp.ProductCategoryName,
SUM(fs.NetRevenue) AS TotalNetRevenue,
SUM(fs.OrderQty) AS TotalOrders
FROM [dbo].[FactSales] fs
LEFT JOIN [dbo].[DimDate] dd ON CAST(fs.OrderDate AS DATE) = dd.DateKey
LEFT JOIN [dbo].[DimProducts] dp ON fs.ProductID = dp.ProductID
GROUP BY
dd.Year,
dd.Month,
dp.ProductCategoryName;
Example Prompt: Modify the query to round the TotalNetRevenue to two decimal places.
Screenshot_of_Microsoft_Fabric_Data_Warehouse_interface_showing_the_Save_as_view
There’s more you can do for a retail scenario with Copilot for Data Warehouse, this is a baseline of the thought process of understanding your data, how to use leverage Copilot to create views based on a specific need, building a schema and loading existing data into the new schema. This can be applied to other scenarios; you have to mindful of what is needed based on your requirements.
You can find a deep dive of using Copilot for Data Warehouse in our Copilot Learning Hub for Data professional’s tutorial.
What is data warehousing in Microsoft Fabric?
Copilot for Data Warehouse OverviewMicrosoft Fabric decision guide: Choose between Warehouse and Lakehouse
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.