Bird
Raised Fist0
Power BIbi_tool~10 mins

Line charts 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 create a line chart visual in Power BI using the 'Date' field on the axis.

Power BI
LineChart = LineChartVisual()
LineChart.Axis = [1]
Drag options to blanks, or click blank then click option'
ADate
BSales
CCategory
DRegion
Attempts:
3 left
💡 Hint
Common Mistakes
Using a measure like 'Sales' as the axis instead of a date field.
Choosing a categorical field that does not represent time.
2fill in blank
medium

Complete the DAX measure to calculate total sales for the line chart.

Power BI
TotalSales = CALCULATE(SUM(Sales[[1]]))
Drag options to blanks, or click blank then click option'
AAmount
BQuantity
CPrice
DDiscount
Attempts:
3 left
💡 Hint
Common Mistakes
Summing 'Quantity' instead of sales amount.
Using 'Price' which is unit price, not total sales.
3fill in blank
hard

Fix the error in the DAX formula to calculate running total sales over time.

Power BI
RunningTotal = CALCULATE(SUM(Sales[Amount]), FILTER(ALL(Sales[Date]), Sales[Date] [1] MAX(Sales[Date])))
Drag options to blanks, or click blank then click option'
A>
B=
C<=
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which excludes the current date.
Using '=' which only includes one date.
4fill in blank
hard

Fill both blanks to create a line chart that filters sales for the year 2023 and sums the amount.

Power BI
FilteredSales = CALCULATE(SUM(Sales[Amount]), FILTER(Sales, YEAR(Sales[[1]]) [2] 2023))
Drag options to blanks, or click blank then click option'
ADate
B=
C>
DRegion
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-date field like 'Region' in YEAR function.
Using '>' which filters for years after 2023, not equal.
5fill in blank
hard

Fill all three blanks to create a measure that calculates average sales per month for 2022.

Power BI
AvgSalesPerMonth = DIVIDE(CALCULATE(SUM(Sales[[1]]), FILTER(Sales, YEAR(Sales[[2]]) [3] 2022)), 12)
Drag options to blanks, or click blank then click option'
AAmount
BDate
C=
DQuantity
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Quantity' instead of 'Amount' for sales value.
Using '>' or '<' instead of '=' for year filter.

Practice

(1/5)
1. What is the main purpose of a line chart in Power BI?
easy
A. To list raw data values in a table format
B. To display data as separate categories without order
C. To show trends and changes over time or order
D. To compare parts of a whole using slices

Solution

  1. Step 1: Understand the function of line charts

    Line charts are designed to show how data changes over time or a sequence.
  2. Step 2: Compare with other chart types

    Other charts like pie charts show parts of a whole, tables show raw data, and bar charts show categories without order.
  3. Final Answer:

    To show trends and changes over time or order -> Option C
  4. Quick Check:

    Line chart = trends over time [OK]
Hint: Line charts always show data changes over time or order [OK]
Common Mistakes:
  • Confusing line charts with pie charts
  • Using line charts for unordered categories
  • Thinking line charts show raw data tables
2. Which of the following is the correct way to set up a line chart in Power BI?
easy
A. Place numeric values on the X-axis and dates on the Y-axis
B. Place a date or ordered category on the X-axis and numeric values on the Y-axis
C. Use only text categories on both axes
D. Use a pie chart visual instead of a line chart

Solution

  1. Step 1: Identify axis roles in line charts

    The X-axis should have dates or ordered categories to show progression, and the Y-axis should have numeric values to show changes.
  2. Step 2: Eliminate incorrect setups

    Numeric values on X-axis or text-only axes do not show trends properly; pie charts are a different visual type.
  3. Final Answer:

    Place a date or ordered category on the X-axis and numeric values on the Y-axis -> Option B
  4. Quick Check:

    X-axis = date/order, Y-axis = values [OK]
Hint: X-axis = time/order, Y-axis = numbers for line charts [OK]
Common Mistakes:
  • Swapping X and Y axis roles
  • Using text categories on both axes
  • Choosing wrong visual type
3. Given this data for sales over months: January=100, February=150, March=120, what will the line chart show for March compared to February?
medium
A. A point lower than February
B. A point higher than February
C. A point equal to February
D. No point for March

Solution

  1. Step 1: Compare March and February sales values

    March sales are 120, which is less than February's 150.
  2. Step 2: Understand line chart plotting

    The line chart plots points on the Y-axis by value; March's point will be lower than February's.
  3. Final Answer:

    A point lower than February -> Option A
  4. Quick Check:

    120 < 150 means March point lower [OK]
Hint: Lower value means lower point on line chart [OK]
Common Mistakes:
  • Assuming March is higher than February
  • Confusing equal values
  • Thinking March data is missing
4. You created a line chart but it shows all points as a flat line at zero. What is the most likely cause?
medium
A. The data has negative values only
B. The date field is on the Y-axis instead of X-axis
C. The chart type is set to pie chart by mistake
D. The numeric values field is missing or contains zeros

Solution

  1. Step 1: Check numeric values field in the chart

    If the values field is missing or all zeros, the line will be flat at zero.
  2. Step 2: Verify axis and chart type

    Having date on Y-axis or wrong chart type would cause different errors, not flat zero line; negative values still plot below zero.
  3. Final Answer:

    The numeric values field is missing or contains zeros -> Option D
  4. Quick Check:

    Missing or zero values cause flat line [OK]
Hint: Check if values field is empty or zero-filled [OK]
Common Mistakes:
  • Ignoring missing values field
  • Confusing axis placement errors
  • Assuming negative values cause flat line
5. You want to compare sales trends for two products over the same months using a line chart. What is the best way to set this up in Power BI?
hard
A. Place months on X-axis, sales on Y-axis, and use product as Legend to show separate lines
B. Place sales on X-axis, months on Y-axis, and filter by product one at a time
C. Create two separate line charts, one for each product, and place side by side
D. Use a pie chart to compare sales of both products

Solution

  1. Step 1: Understand how to show multiple lines in one chart

    Using the Legend field with product categories creates separate lines for each product on the same chart.
  2. Step 2: Confirm axis roles for trend comparison

    Months go on X-axis to show time order, sales on Y-axis to show values, and product in Legend to differentiate lines.
  3. Final Answer:

    Place months on X-axis, sales on Y-axis, and use product as Legend to show separate lines -> Option A
  4. Quick Check:

    Legend = product for multiple lines [OK]
Hint: Use Legend for categories to show multiple lines [OK]
Common Mistakes:
  • Swapping X and Y axes
  • Using separate charts instead of Legend
  • Choosing wrong chart type
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