Bird
Raised Fist0
Power BIbi_tool~10 mins

Data source and dataset in Power BI - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load data from an Excel file in Power BI.

Power BI
let Source = Excel.Workbook(File.Contents([1]), null, true) in Source
Drag options to blanks, or click blank then click option'
A"data.csv"
B"data.json"
C"data.xlsx"
D"data.txt"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a CSV or JSON file name with Excel.Workbook causes errors.
Forgetting to put quotes around the file name.
2fill in blank
medium

Complete the code to select the first sheet from the Excel data source.

Power BI
let Source = Excel.Workbook(File.Contents("data.xlsx"), null, true), Sheet1 = Source[1] in Sheet1
Drag options to blanks, or click blank then click option'
A{0}
B{1}
C[1]
D[0]
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets instead of curly braces for list indexing.
Using index 1 when the first sheet is at index 0.
3fill in blank
hard

Fix the error in the code to filter rows where the 'Sales' column is greater than 1000.

Power BI
let Source = Excel.Workbook(File.Contents("data.xlsx"), null, true), Sheet1 = Source{1}[Data], FilteredRows = Table.SelectRows(Sheet1, each [1]) in FilteredRows
Drag options to blanks, or click blank then click option'
Aeach Sales > 1000
B[Sales] > 1000
C[Sales] => 1000
Deach [Sales] > 1000
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting 'each' before the condition.
Using '=>' instead of '>' for comparison.
Not putting the column name in square brackets.
4fill in blank
hard

Fill both blanks to create a new column 'Total' by multiplying 'Quantity' and 'Price'.

Power BI
let Source = Excel.Workbook(File.Contents("data.xlsx"), null, true), Sheet1 = Source{1}[Data], AddedColumn = Table.AddColumn(Sheet1, "Total", each [1] * [2]) in AddedColumn
Drag options to blanks, or click blank then click option'
A[Quantity]
B[Price]
CQuantity
DPrice
Attempts:
3 left
💡 Hint
Common Mistakes
Using column names without square brackets.
Using column names as strings instead of references.
5fill in blank
hard

Fill all three blanks to create a filtered table with only rows where 'Region' equals 'West' and select columns 'Product' and 'Sales'.

Power BI
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
Drag options to blanks, or click blank then click option'
A[Region]
B"West"
C[Product, Sales]
D{"Product", "Sales"}
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets with multiple column names as a single string.
Not quoting string values.
Using square brackets instead of curly braces for column list.

Practice

(1/5)
1. What is a data source in Power BI?
easy
A. The original location where data is stored before importing
B. A visual report created in Power BI
C. A chart made from data
D. A filter applied to data

Solution

  1. Step 1: Understand the term 'data source'

    A data source is where data originally exists, like a database or file.
  2. Step 2: Differentiate from dataset

    A dataset is the data imported into Power BI for analysis, not the original location.
  3. Final Answer:

    The original location where data is stored before importing -> Option A
  4. Quick Check:

    Data source = original data location [OK]
Hint: Data source is where data lives before Power BI imports it [OK]
Common Mistakes:
  • Confusing data source with dataset
  • Thinking data source is a report or visualization
  • Mixing data source with filters
2. Which of the following is the correct way to add a new dataset in Power BI?
easy
A. Click 'Get Data' and select the data source to load data
B. Create a new report without connecting to any data
C. Use the 'Format' pane to add data
D. Right-click on a visual and select 'Add Dataset'

Solution

  1. Step 1: Identify how to load data

    Power BI uses 'Get Data' to connect to data sources and load datasets.
  2. Step 2: Eliminate incorrect options

    Creating reports without data or using format pane does not add datasets.
  3. Final Answer:

    Click 'Get Data' and select the data source to load data -> Option A
  4. Quick Check:

    Loading data = Get Data button [OK]
Hint: Use 'Get Data' to import datasets from sources [OK]
Common Mistakes:
  • Trying to add data from the Format pane
  • Assuming reports create datasets automatically
  • Looking for dataset options in visuals
3. Consider this Power BI M code snippet to load data from a CSV file:
let
  Source = Csv.Document(File.Contents("C:\\Data\\sales.csv"),[Delimiter=",", Columns=3, Encoding=1252, QuoteStyle=QuoteStyle.None]),
  ChangedType = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Sales", Int64.Type}, {"Region", type text}})
in
  ChangedType

What does the Source step represent?
medium
A. A visualization of sales data
B. The dataset after changing column types
C. The original data loaded from the CSV file
D. A filter applied to the sales data

Solution

  1. Step 1: Analyze the 'Source' step

    'Source' uses Csv.Document and File.Contents to load raw data from the CSV file.
  2. Step 2: Understand subsequent steps

    'ChangedType' modifies data types; 'Source' is before this, so raw data.
  3. Final Answer:

    The original data loaded from the CSV file -> Option C
  4. Quick Check:

    Source = raw data load step [OK]
Hint: 'Source' usually means raw data load in Power Query [OK]
Common Mistakes:
  • Confusing 'Source' with transformed data
  • Thinking 'Source' is a visualization
  • Assuming 'Source' applies filters
4. You tried to load data from an Excel file in Power BI but got an error. Which of these is the most likely cause?
medium
A. You need to format the data as a table in Power BI
B. You forgot to create a report before loading data
C. Power BI does not support Excel files
D. The file path is incorrect or file is missing

Solution

  1. Step 1: Identify common errors loading Excel data

    Incorrect file path or missing file causes load errors.
  2. Step 2: Eliminate incorrect reasons

    Power BI supports Excel files; reports are created after loading data; formatting in Power BI is not required to load.
  3. Final Answer:

    The file path is incorrect or file is missing -> Option D
  4. Quick Check:

    File path errors cause load failures [OK]
Hint: Check file path first if data load fails [OK]
Common Mistakes:
  • Thinking Power BI can't load Excel files
  • Assuming report creation is needed before data load
  • Believing data must be pre-formatted in Power BI
5. You want to combine sales data from two different Excel files into one dataset in Power BI. What is the best approach?
hard
A. Load both files as separate datasets and create a relationship between them
B. Use Power Query to append the two tables into a single dataset
C. Load one file and manually copy data from the other into Power BI
D. Create two reports, one for each file, and merge reports later

Solution

  1. Step 1: Understand combining data sources

    Appending tables in Power Query merges data into one dataset for analysis.
  2. Step 2: Evaluate other options

    Creating relationships keeps data separate; manual copying is inefficient; merging reports is not practical.
  3. Final Answer:

    Use Power Query to append the two tables into a single dataset -> Option B
  4. Quick Check:

    Append tables in Power Query to combine datasets [OK]
Hint: Append tables in Power Query to merge datasets [OK]
Common Mistakes:
  • Using relationships instead of appending for combined data
  • Copy-pasting data manually
  • Merging reports instead of datasets
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard