Tableau - LOD Expressions

Tableau - Customer Aquisition with LOD Expressions

The task is to show customer growth over time for different regions on the macro and micro level.

Step 1: Create a new LOD calculated field in Tableau called "First Purchase Date" and type


                {FIXED [Customer ID]: MIN([Order Date])}
                 

Step 2: Create a calculated field in Tableau called "Customer Type" and type


                IF [First Purchase Date] = [Order Date] THEN 'new' ELSE 'existing' END
                 

Step 3: Add "First Purchase Date" to the column shelf, "Customer ID" to the row shelf and "Customer Type" to Filter. Filter only on "new"

Step 4: For YEAR(First Purchase Date) in the Columns shelf, right click and select the Quarter (the continuous one above week number).

  • Calculation Type: Percentage of Total
  • Compute using: Table (down)

Step 5: Right click on "Customer ID" in the Rows shelf and select:

  • Measure -> Count (Distinct)
  • Quick Table Calculation -> Running Total

Step 6: Drag Market to Color


Adding Drill Down Features


Step 7: Rename the current sheet to Market View and right click and duplicate sheet. Change the new sheet name to Country View. Duplicate again and rename to State View

Step 8: In Country View drag "Country" to color and in State View drag "State" to color.

Step 8: In "Market View" select Worksheet and Actions. Add action as a filter action and in the pop up menu:

  • Name: Market to Country
  • Source Sheets: Market View
  • Target Sheets: Country View
  • Run Action on: Select and run on single select only
  • Clearing Section will: Leave the filter
  • Target Filters: Selected Fields -> Add Filter with Source and Target Field being Market

Step 9: In "State View" select Worksheet and Actions. Add action as a filter action and in the pop up menu:

  • Name: Country to State
  • Source Sheets: Country View
  • Target Sheets: State View
  • Run Action on: Select and run on single select only
  • Clearing Section will: Leave the filter
  • Target Filters: Selected Fields -> Add Filter with Source and Target Field being Country

Tip: When creating a Dashboard you can create similar action filters. Similar Actions need to be recreated at the dashboard level. (ie. Dashboard -> Actions tab up top.) Similarily, create three separate dashboards using Market View, Country View and State View sheets.

Tableau - Customer Cohorts

The Task is to find the % of sales each year from new and old customers

Step 1: Create a new LOD calculated field in Tableau called "First Purchase Date" and type


                {FIXED [Customer ID]: MIN([Order Date])}
                 

Step 2: Add "OrderDate" to the column shelf, "First Purchase Date" to color and "Sales" to the row shelf

Step 3: For SUM(Sales) in the row shelf, right click and select Add Table Calculation with the following options:

  • Calculation Type: Percentage of Total
  • Compute using: Table (down)

You can now see the percentage of sales for each customer cohort.

Tip: To get a more granular view of sales, expand YEAR(Order Date) to view order dates by quarter and month.

Tableau - Customer Order Frequency

The task is to count the number of customers who have made 1 order, 2 orders and so on.

Step 1: Create a new calculated field in Tableau called "Orders By Customer" and type


                    {FIXED [Customer Name] : COUNTD([Order ID])}
                     

Step 2: Drag "Orders By Customer" to Columns and "Customer Name" to Rows

Step 3: Right click "Customer Name" and select Measure -> Count (Distinct)

Step 4: Right click "Orders By Customer" and select Dimension

Step 5: Right click "Orders By Customer" and select Discrete

Step 6: Right click "Orders By Customer" and select Sort

Step 7: Sort Order Descending and Sort By Field "Customer Name with Aggregration as Count (Distinct)

Step 8: Edit the tool tip by clearing the default and replacing with:


                    <CNTD(Customer Name)> customers have made <Orders By Customer> orders
                     

Tableau - Calculating % Of Total Sales

The task is to find the percentage of total sales by region. There are two ways to do this in Tableau.

Method 1 (LOD Expression):

Step 1: Create a new calculated field in Tableau called "All Sales" and type


                {SUM([Sales])}
                 

Step 2: Create a new calculated field called "% of Total" and type


                 [Sales]/[All Sales]
                 

Step 3: Right click "% of Total" and select Default Properties -> Number Format -> Percentage

Step 4: Drag "Region" to rows and "% of Total" to rows

Step 5: Sort Order Descending and Sort By Field "Sales" with Aggregration as Sum


Method 2 (Quick Table Calc):

Step 1:Drag "Region" and "Sales" to Rows

Step 2:Right click on "Sales" and select Quick Table Calculation -> Percentage of Total

Step 3: Sort Order Descending and Sort By Field "Sales" with Aggregration as Sum

Tableau - LOD Sales Tracker

The Task is to create a Sales Per Day Tracker with high, medium and low sales days

Step 1: Create a new LOD calculated field in Tableau called "Sales Per Day" and type


                {FIXED [Order Date]: SUM([Sales])}
                 

Step 2: Create a new LOD calculated field in Tableau called "Sales Per Day" and type


                   IF [Sales Per Day] > 3000 THEN 'high'
                   ELSEIF [Sales Per Day] > 2000 THEN 'medium'
                   ELSE 'low'
                   END
                 

Step 3: Add "OrderDate" to the both the row and column shelf and "Sales Tracker" to color shelf and row shelf

Step 4: For "OrderDate" in the row shelf, right click and select measure->Count (Distinct)

Step 5: Expand YEAR(OrderDate) on the row shelf to show quarters

Step 6: On the right hand side, reorder the legend by clicking and dragging to show high, medium and low

Step 7: Set the marks type to Bar or Area chart.





Services
  • SEO
  • Online Advertising
  • Online Ordering For Restaurants
  • Data Analytics

  • External Resources 4 Developers
  • CSS Tricks
  • MDN

  • Dash-Intel.com is a Power BI and Tableau resource site around data visualizations and building business dashboards.

    Data Analytics consultants in Edmonton, Alberta specializing in Tableau and marketing analytics

    Copyright 2020 Dash-Intel.com Terms / All rights reserved.