Complete the code to load a CSV file in Power BI using Power Query M language.
Source = Csv.Document(File.Contents([1]),[Delimiter=",", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None])
In Power Query M, File.Contents requires the full file path as a string to load the CSV file.
Complete the code to specify the delimiter when importing a text file in Power Query M.
Source = Csv.Document(File.Contents("data.txt"), [Delimiter=[1], Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.Csv])
The tab character is represented as #(tab) in Power Query M to specify tab-delimited files.
Fix the error in the code to correctly import a CSV file with headers in Power Query M.
Source = Csv.Document(File.Contents("sales.csv"), [Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None]) PromotedHeaders = Table.PromoteHeaders([1])
Csv.Document instead of the loaded data variable.File.Contents which returns binary data.The Table.PromoteHeaders function requires a table as input, which is the Source variable holding the CSV data.
Fill both blanks to correctly filter rows where the 'Status' column equals 'Active' after importing a CSV.
FilteredRows = Table.SelectRows(PromotedHeaders, [1][Status] [2] "Active")
== which is not valid in M.each keyword.In Power Query M, Table.SelectRows uses a function starting with each and the equality operator is =.
Fill all three blanks to convert a CSV import to a table, promote headers, and change the data type of the 'Date' column to date.
Source = Csv.Document(File.Contents("data.csv"), [Delimiter=",", Columns=4, Encoding=1252, QuoteStyle=QuoteStyle.None]) TableWithHeaders = [1](Source) ChangedType = Table.TransformColumnTypes(TableWithHeaders, {{"Date", [2].[3])
Table.TransformColumns instead of Table.TransformColumnTypes.First, promote headers with Table.PromoteHeaders. Then, use Table.TransformColumnTypes with type.date to change the 'Date' column type.