How to do it...

In this example, a business team maintains a list of employee IDs in an Excel workbook and wants the ability to access several columns from the employee dimension table in the data model related to these IDs.

  1. Create an M query that retrieves the employee IDs from the Excel workbook:
let Source = Excel.Workbook(File.Contents("J:\Finance\TeamFiles\EmployeeIDs.xlsx"), null, true),ExcelTable = Source{[Item="EmployeeTbl",Kind="Table"]}[Data],TypeConversion = Table.TransformColumnTypes(ExcelTable,{{"Employee Alternate Key", type text}}),RemoveNullsAndDuplicates = Table.Distinct(Table.SelectRows(TypeConversion, each [Employee Alternate Key] <> null))in RemoveNullsAndDuplicates
  • The employee IDs are stored in an Excel table object ...

Get Microsoft Power BI Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.