Complete the code to load data from an Excel file in Power BI.
let Source = Excel.Workbook(File.Contents([1]), null, true) in Source
Power BI uses Excel.Workbook to load Excel files. The file name must end with .xlsx.
Complete the code to select the first sheet from the Excel data source.
let Source = Excel.Workbook(File.Contents("data.xlsx"), null, true), Sheet1 = Source[1] in Sheet1
In Power Query M language, lists use curly braces and are zero-indexed. The first sheet is at index 0 in this context.
Fix the error in the code to filter rows where the 'Sales' column is greater than 1000.
let Source = Excel.Workbook(File.Contents("data.xlsx"), null, true), Sheet1 = Source{1}[Data], FilteredRows = Table.SelectRows(Sheet1, each [1]) in FilteredRows
The Table.SelectRows function requires a function starting with 'each' and the column name in square brackets.
Fill both blanks to create a new column 'Total' by multiplying 'Quantity' and 'Price'.
let Source = Excel.Workbook(File.Contents("data.xlsx"), null, true), Sheet1 = Source{1}[Data], AddedColumn = Table.AddColumn(Sheet1, "Total", each [1] * [2]) in AddedColumn
In Power Query, column names must be in square brackets when used inside 'each'.
Fill all three blanks to create a filtered table with only rows where 'Region' equals 'West' and select columns 'Product' and 'Sales'.
let Source = Excel.Workbook(File.Contents("data.xlsx"), null, true), Sheet1 = Source{1}[Data], Filtered = Table.SelectRows(Sheet1, each [1] = [2]), Result = Table.SelectColumns(Filtered, [3]) in Result
Use square brackets for column names, quotes for string values, and curly braces with quoted column names for selecting columns.