Bird
Raised Fist0
Power BIbi_tool~8 mins

Replace values in Power BI - Dashboard Guide

Choose your learning style10 modes available
Dashboard Mode - Replace values
Dashboard Goal

This dashboard helps us see sales data where missing or unclear product categories are replaced with a clear label "Unknown Category". This makes the data easier to understand and analyze.

Sample Data
Order IDProductCategorySales
1001NotebookStationery150
1002Pen50
1003Desk LampElectronics200
1004Chair300
1005PaperStationery100
Dashboard Components
  • KPI Card: Total Sales
    Formula: Total Sales = SUM(Sales[Sales])
    Result: 800
  • Table: Sales by Category with Replaced Values
    Formula: Category Clean = IF(ISBLANK(Sales[Category]), "Unknown Category", Sales[Category])
    Then create a table visual with Category Clean and Sales summed.
    Result:
    Category CleanSales
    Stationery250
    Unknown Category350
    Electronics200
  • Bar Chart: Sales by Category Clean
    Uses the same Category Clean field on X-axis and sum of Sales on Y-axis.
    Shows clear categories including "Unknown Category".
Dashboard Layout
+----------------------+----------------------+
|      Total Sales      |   Sales by Category  |
|       (KPI Card)      |       (Bar Chart)    |
+----------------------+----------------------+
|              Sales by Category with Replaced Values Table              |
+------------------------------------------------------------------------+
Interactivity

Filters on date or region (if added) will update all components together. The replacement of blank categories with "Unknown Category" ensures the table and chart always show all sales data clearly, even if some categories are missing.

Self Check

If you add a filter to show only sales above 100, which components update and what happens to the "Unknown Category" sales?

  • All components update to show filtered data.
  • "Unknown Category" sales will only include orders with sales above 100 (e.g., Chair with 300 sales).
Key Result
Dashboard showing total sales and sales by product category with missing categories replaced by 'Unknown Category'.

Practice

(1/5)
1. What is the main purpose of using Replace Values in Power BI's Power Query?
easy
A. To clean or standardize data by changing specific values
B. To create new calculated columns
C. To filter rows based on conditions
D. To merge two tables together

Solution

  1. Step 1: Understand Replace Values function

    Replace Values is used to change specific values in a column to clean or standardize data.
  2. Step 2: Compare with other options

    Creating columns, filtering rows, or merging tables are different operations not related to Replace Values.
  3. Final Answer:

    To clean or standardize data by changing specific values -> Option A
  4. Quick Check:

    Replace Values = Clean or standardize data [OK]
Hint: Replace Values changes data entries to fix or standardize them [OK]
Common Mistakes:
  • Confusing Replace Values with creating new columns
  • Thinking Replace Values filters data
  • Mixing Replace Values with merging tables
2. Which of the following is the correct syntax to replace all occurrences of "old" with "new" in the column "Status" using Table.ReplaceValue in Power Query M language?
easy
A. Table.ReplaceValue(Source, "old", "new", Replacer.ReplaceText)
B. Table.ReplaceValue(Source, "old", "new", Replacer.ReplaceValue, {"Status"})
C. Table.ReplaceValue(Source, "old", "new", Replacer.ReplaceText, "Status")
D. Table.ReplaceValue(Source, "old", "new", Replacer.ReplaceText, {"Status"})

Solution

  1. Step 1: Identify correct replacer and column list

    The correct replacer for text replacement is Replacer.ReplaceText and the columns must be passed as a list, e.g., {"Status"}.
  2. Step 2: Check syntax correctness

    Table.ReplaceValue(Source, "old", "new", Replacer.ReplaceText, {"Status"}) uses correct replacer and column list syntax. Options B, C, and D have wrong replacer or column argument format.
  3. Final Answer:

    Table.ReplaceValue(Source, "old", "new", Replacer.ReplaceText, {"Status"}) -> Option D
  4. Quick Check:

    Correct replacer and column list = Table.ReplaceValue(Source, "old", "new", Replacer.ReplaceText, {"Status"}) [OK]
Hint: Use Replacer.ReplaceText and column list in curly braces [OK]
Common Mistakes:
  • Using wrong replacer like Replacer.ReplaceValue
  • Passing column name as string instead of list
  • Omitting replacer argument
3. Given the following Power Query M code snippet:
let
  Source = Table.FromRecords({[Name="John", Age=30], [Name="john", Age=25]}),
  Replaced = Table.ReplaceValue(Source, "john", "Jonathan", Replacer.ReplaceText, {"Name"})
in
  Replaced

What will be the value in the "Name" column for the second row after replacement?
medium
A. john
B. John
C. Jonathan
D. Error

Solution

  1. Step 1: Understand case sensitivity in ReplaceValue

    Table.ReplaceValue with Replacer.ReplaceText is case sensitive by default, so "john" (lowercase) matches only exact lowercase.
  2. Step 2: Check the second row value

    The second row has "john" lowercase, so it matches and should be replaced with "Jonathan". But the first row "John" with uppercase J is not replaced.
  3. Final Answer:

    Jonathan -> Option C
  4. Quick Check:

    Case sensitive replace changes "john" to "Jonathan" [OK]
Hint: ReplaceValue is case sensitive by default [OK]
Common Mistakes:
  • Assuming replace is case insensitive
  • Expecting "John" to be replaced
  • Confusing row order
4. You wrote this Power Query M code to replace "N/A" with null in the "Score" column:
Table.ReplaceValue(Source, "N/A", null, Replacer.ReplaceText, {"Score"})

But it throws an error. What is the likely cause?
medium
A. Using Replacer.ReplaceText instead of Replacer.ReplaceValue for text replacement
B. Replacing with null is not allowed in Power Query
C. The column list should be a string, not a list
D. The source table is missing

Solution

  1. Step 1: Check replacer type for text replacement

    Replacing text values with null requires Replacer.ReplaceValue, not Replacer.ReplaceText.
  2. Step 2: Understand null replacement

    Replacing with null is valid, but replacer must match data type operation. Using wrong replacer causes error.
  3. Final Answer:

    Using Replacer.ReplaceText instead of Replacer.ReplaceValue for text replacement -> Option A
  4. Quick Check:

    Correct replacer needed for text replace [OK]
Hint: Use Replacer.ReplaceValue for null replacement, not ReplaceText [OK]
Common Mistakes:
  • Using wrong replacer for text replacement
  • Thinking null replacement is invalid
  • Passing column name as string instead of list
5. You have a table with a "Category" column containing values: "Fruit", "fruit", "FRUIT", and "Vegetable". You want to replace all variations of "fruit" (case insensitive) with "Produce" using Power Query. Which approach correctly achieves this?
hard
A. Use Table.ReplaceValue with Replacer.ReplaceText and set case insensitive option
B. Add a custom column with Text.Lower and replace "fruit" with "Produce" there
C. Use Table.ReplaceValue with Replacer.ReplaceText multiple times for each case variant
D. Use Table.ReplaceValue with Replacer.ReplaceValue ignoring case automatically

Solution

  1. Step 1: Understand case sensitivity of ReplaceValue

    Table.ReplaceValue with Replacer.ReplaceText is case sensitive and does not have a built-in case insensitive option.
  2. Step 2: Replace all case variants

    Adding a custom column with Text.Lower converts all values to lowercase, allowing a single replace of "fruit" with "Produce" in that column.
  3. Step 3: Evaluate other options

    Using multiple ReplaceValue calls is inefficient and error-prone. No case insensitive flag exists for ReplaceValue. ReplaceValue does not ignore case automatically.
  4. Final Answer:

    Add a custom column with Text.Lower and replace "fruit" with "Produce" there -> Option B
  5. Quick Check:

    Use Text.Lower in custom column for case insensitive replace [OK]
Hint: Use Text.Lower in custom column for case insensitive replace [OK]
Common Mistakes:
  • Expecting case insensitive replace by default
  • Trying to replace all cases in one call
  • Using wrong replacer or ignoring case
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