- Microsoft Power BI Cookbook
- Brett Powell
- 168字
- 2025-04-04 18:18:12
M queries in Power BI Desktop
- Create M queries containing the data source connection information (for example, server name, or database name).
- For example, an M query with the Sql.Database() function could serve as a data source for other tables
- Build an M query for each dimension and fact table that accesses the SQL views defined in step 1.
- In this example, the AWProd query contains the data source information and a fact table view is accessed:
let
Source = AWProd,
InternetSales = Source{[Schema = "BI_Sales", Item = "vFact_InternetSales"]}[Data]
in
InternetSales
- Each new query references the data source query and is given the name to be surfaced in the model
- Duplicate a query and replace the Item parameter with the source view. Disable the load of the data source query.

Query groups in Query Editor
- Confirm that the column data types align with the design (for example, a fixed decimal number to avoid rounding issues).
- Close the Query Editor and load the tables into the Power BI model.