M queries in Power BI Desktop

  1. 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
  2. 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
  1. 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
  1. Confirm that the column data types align with the design (for example, a fixed decimal number to avoid rounding issues).
  2. Close the Query Editor and load the tables into the Power BI model.