Dashboard Mode - Splitting and merging columns
Business Question
How can we split full customer names into first and last names, and merge city and state into a single location column for better analysis?
How can we split full customer names into first and last names, and merge city and state into a single location column for better analysis?
| CustomerID | FullName | City | State | Sales |
|---|---|---|---|---|
| 101 | John Smith | Seattle | WA | 250 |
| 102 | Mary Johnson | Portland | OR | 300 |
| 103 | James Lee | San Francisco | CA | 400 |
| 104 | Linda Davis | Denver | CO | 150 |
| 105 | Michael Brown | Seattle | WA | 350 |
=SUM(Sales) showing 1450FirstName and LastName created by splitting FullName at the space.City and State with a comma and space.Location showing total sales per city-state combination.
// Split FullName into FirstName
FirstName = LEFT(Customer[FullName], FIND(" ", Customer[FullName]) - 1)
// Split FullName into LastName
LastName = RIGHT(Customer[FullName], LEN(Customer[FullName]) - FIND(" ", Customer[FullName]))
// Merge City and State into Location
Location = Customer[City] & ", " & Customer[State]
// Total Sales measure
Total Sales = SUM(Customer[Sales])
+----------------------+-------------------------+ | Total Sales | Sales by Location | | (KPI Card) | (Bar Chart) | +----------------------+-------------------------+ | Customer Details Table (with split names and merged location) | +-----------------------------------------------------------------------------+
A slicer on Location allows filtering the bar chart and the customer details table to show only customers from the selected city-state. Selecting a location updates the total sales KPI to reflect sales only from that location.
If you add a filter for Location = "Seattle, WA", which components update and what will the total sales show?
Splitting means:FirstName and LastName with a space separator in Power Query?FullName with values like "John Doe", what will be the result of this Power Query step?Table.SplitColumn(Source, "FullName", Splitter.SplitTextByDelimiter(" "), {"FirstName", "LastName"})City and Country using this code:Table.AddColumn(Source, "Location", each [City] + ", " + [Country])
Address with values like "123 Main St, Springfield, IL". You want to split it into Street, City, and State columns. Which Power Query step correctly splits this?Pass the test and this pattern moves unknown