Use segment names to segment

In this use case, you want to use an existing segment for the Fishing product category, that you have defined in Customer Journey Analytics. To segment and report on product names and occurrences (events) during January 2023.

Customer Journey Analytics

Inspect the segment that you want to use in Customer Journey Analytics.

Customer Journey Analytics Use Filter Names To Filter

You then can use that segment in an example Using Segment Names To Segment panel for the use case:

Customer Journey Analytics Distinct Count Values

BI tools
note prerequisites
PREREQUISITES
Ensure you have validated a successful connection, can list data views, and use a data view for the BI tool for which you want to try out this use case.
tabs
Power BI Desktop
  1. In the Data pane:

    1. Select daterange.
    2. Select filterName.
    3. Select product_name.
    4. Select sum occurrences.

You see a visualization displaying Error fetching data for this visual.

  1. In the Filters pane:

    1. Select filterName is (All) from Filters on this visual.
    2. Select Basic filtering as the Filter type.
    3. Underneath the Search field, select Fishing Products, which is the name of the existing filter defined in Customer Journey Analytics.
    4. Select daterange is (All) from Filters on this visual.
    5. Select Advanced filtering as the Filter type.
    6. Define the filter to Show items when the value is on or after 1/1/2023 And is before 2/1/2023.
    7. Select CrossSize75 to remove filterName from Columns.
    8. Select CrossSize75 to remove daterange from Columns.

    You see the table updated with the applied filterName filter. Your Power BI Desktop should look like below.

    Power BI Desktop Using Date Range Names To Filter

Tableau Desktop
  1. Select the Sheet 1 tab at the bottom to switch from Data source. In the Sheet 1 view:

    1. Drag the Filter Name entry from the Tables list in the Filters shelf.

    2. In the Filter [Filter Name] dialog ensure Select from list is selected, and select Fishing Products from the list. Select Apply and OK.

    3. Drag Daterange entry from the Tables list in the Filters shelf.

    4. In the Filter Field [Daterange] dialog, select Range of Dates and select Next >.

    5. In the Filter [Daterang] dialog, select Range of dates, and select 01/01/2023 - 01/02/2023. Select Apply and OK.

    6. Drag Product Name from the Tables list to Rows.

    7. Drag Occurrences entry from the Tables list and drop the entry in the field next to Columns. The value changes to SUM(Occurrences).

    8. Select Text Table from Show Me.

    9. Select Fit Width from the Fit drop-down menu.

      Your Tableau Desktop should look like below.

      Tableau Desktop Multiple Dimension Ranked Filter

Looker
  1. In the Explore interface of Looker, ensure you do have a clean setup. If not, select Setting Remove fields and filters.

  2. Select + Filter underneath Filters.

  3. In the Add Filter dialog:

    1. Select ‣ Cc Data View
    2. From the list of fields, select ‣ Daterange Date then Daterange Date.
      Looker filter
  4. Specify the Cc Data View Daterange Date filter as is in range 2023/01/01 until (before) 2023/02/01.

  5. Select + Filter underneath Filters to add another filter.

  6. In the Add Filter dialog:

    1. Select ‣ Cc Data View
    2. From the list of fields, select ‣ Filter name.
  7. Ensure is the selection for the filter.

  8. Select Fishing Products from the list of possible values.

  9. From the ‣ Cc Data View section in the left rail:

    1. Select Product Name.
    2. Select Count underneath MEASURES in the left rail (at the bottom).
  10. Select Run.

  11. Select ‣ Visualization.

You should see a visualization and table similar as shown below.

Looker count distinct

Jupyter Notebook
  1. Enter the following statements in a new cell.

    code language-python
    data = %sql SELECT filterName FROM cc_data_view;
    style = {'description_width': 'initial'}
    filter_name = widgets.Dropdown(
       options=[d for d, in data],
       description='Filter Name:',
       style=style
    )
    display(filter_name)
    
  2. Execute the cell. You should see output similar to the screenshot below.

    Jupyter Notebook Results

  3. Select Fishing Products from the drop-down menu.

  4. Enter the following statements in a new cell.

    code language-python
    import seaborn as sns
    import matplotlib.pyplot as plt
    data = %sql SELECT product_name AS `Product Name`, COUNT(*) AS Events \
                FROM cc_data_view \
                WHERE daterange BETWEEN '2023-01-01' AND '2023-02-01' \
                   AND filterName = '{filter_name.value}' \
                GROUP BY 1 \
                LIMIT 10;
    df = data.DataFrame()
    df = df.groupby('Product Name', as_index=False).sum()
    plt.figure(figsize=(15, 3))
    sns.barplot(x='Events', y='Product Name', data=df)
    plt.show()
    display(data)
    
  5. Execute the cell. You should see output similar to the screenshot below.

    Jupyter Notebook Results

RStudio
  1. Enter the following statements between ```{r} and ``` in a new chunk. Ensure you use the appropriate filter name. For example, Fishing Products.

    code language-r
    ## Dimension filtered by name
    df <- dv %>%
       filter(daterange >= "2023-01-01" & daterange < "2023-02-01" & filterName == "Fishing Products") %>%
       group_by(product_name) %>%
       count() %>%
       arrange(desc(n), .by_group = FALSE)
    print(df)
    
  2. Run the chunk. You should see output similar to the screenshot below.

    RStudio Results

recommendation-more-help
080e5213-7aa2-40d6-9dba-18945e892f79