0
0
Tableaubi_tool~15 mins

String functions (LEFT, RIGHT, CONTAINS) in Tableau - Real Business Scenario

Choose your learning style9 modes available
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants you to analyze customer data to identify customers from a specific city, extract area codes from phone numbers, and categorize customers based on their email domains.
📊 Data: You have a customer dataset with columns: CustomerID, CustomerName, City, PhoneNumber, and Email.
🎯 Deliverable: Create a Tableau dashboard showing: 1) A list of customers from the city 'Springfield', 2) Extracted area codes from phone numbers, and 3) A count of customers grouped by email domain categories.
Progress0 / 4 steps
Sample Data
CustomerIDCustomerNameCityPhoneNumberEmail
101John SmithSpringfield(217)555-1234john.smith@gmail.com
102Mary JohnsonRivertown(312)555-5678mary.j@outlook.com
103James LeeSpringfield(217)555-8765james.lee@yahoo.com
104Patricia BrownLakeside(415)555-4321pat.brown@gmail.com
105Michael DavisSpringfield(217)555-3456mike.davis@hotmail.com
106Linda WilsonRivertown(312)555-7890linda.wilson@gmail.com
107Robert GarciaLakeside(415)555-6543robert.garcia@yahoo.com
108Barbara MartinezSpringfield(217)555-9876barbara.martinez@outlook.com
1
Step 1: Filter the dataset to show only customers from the city 'Springfield'.
Create a filter on the 'City' field with condition: City = 'Springfield'.
Expected Result
Only customers with City = 'Springfield' are displayed: John Smith, James Lee, Michael Davis, Barbara Martinez.
2
Step 2: Create a calculated field to extract the area code from the PhoneNumber field.
Use the formula: MID([PhoneNumber], 2, 3)
Expected Result
Area codes extracted: '217' for Springfield customers, '312' for Rivertown, '415' for Lakeside.
3
Step 3: Create a calculated field to categorize customers by their email domain (e.g., gmail, yahoo, outlook, hotmail).
Use the formula: IF CONTAINS([Email], 'gmail.com') THEN 'Gmail' ELSEIF CONTAINS([Email], 'yahoo.com') THEN 'Yahoo' ELSEIF CONTAINS([Email], 'outlook.com') THEN 'Outlook' ELSEIF CONTAINS([Email], 'hotmail.com') THEN 'Hotmail' ELSE 'Other' END
Expected Result
Customers categorized by email domain correctly.
4
Step 4: Create a dashboard with three components: 1) Filtered customer list from Springfield, 2) Table showing CustomerName and extracted AreaCode, 3) Bar chart counting customers by Email Domain category.
Add the filtered customer list worksheet, the area code table worksheet, and the email domain bar chart worksheet to the dashboard.
Expected Result
Dashboard displays Springfield customers, their area codes, and email domain counts.
Final Result
---------------------------------------------
| Springfield Customers Dashboard            |
|-------------------------------------------|
| Customers from Springfield:                |
| - John Smith                              |
| - James Lee                              |
| - Michael Davis                          |
| - Barbara Martinez                       |
|                                           |
| Customer Area Codes:                       |
| Name           | Area Code                 |
|----------------|---------------------------|
| John Smith     | 217                       |
| James Lee      | 217                       |
| Michael Davis  | 217                       |
| Barbara Martinez| 217                      |
|                                           |
| Email Domain Counts:                       |
| Gmail: 3                                   |
| Yahoo: 2                                   |
| Outlook: 2                                 |
| Hotmail: 1                                 |
---------------------------------------------
Most Springfield customers have the area code 217.
Gmail is the most common email domain among customers.
The city filter helps focus analysis on a specific location.
Bonus Challenge

Create a calculated field that extracts the last 4 digits of the phone number using RIGHT function and display it in the dashboard.

Show Hint
Use the formula: RIGHT([PhoneNumber], 4) to get the last 4 digits.