Use dimension values to segment

You use the dynamic Hunting value for Product Category to segment products from the hunting category. Alternatively, for those BI tools that do not support the dynamic retrieval of product category values, you create a new segment in Customer Journey Analytics that segments on products from the hunting product category.
Then you want to use the new segment to report on product names and occurrences (events) for products from the hunting category during January 2023.

Customer Journey Analytics

Create a new segment with Title Hunting Products in Customer Journey Analytics.

Customer Journey Analytics Use Dimension Values To Segment

You then can use that segment in an example Using Dimension Values To Filter 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. Select Home from the menu, then select Refresh from the toolbar. You need to refresh the connection to pick up the new filter you just defined in Customer Journey Analytics.

  2. In the Data pane:

    1. Select daterange.
    2. Select product_category.
    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. Select daterange is (All) from Filters on this visual.
    4. Select Advanced filtering as the Filter type.
    5. Define the filter to Show items when the value is on or after 1/1/2023 And is before 2/1/2023.
    6. Select Basic filter as the Filter type for product_category, and select Hunting from the list of possible values.
    7. Select CrossSize75 to remove filterName from Columns.
    8. Select CrossSize75 to remove daterange from Columns.

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

    Power BI Desktop Using Date Range Names To Filter

Tableau Desktop

AlertRed Tableau Desktop does not support fetching the dynamic list of product categories from Customer Journey Analytics. Instead, this use case uses the newly created filter for Hunting Products and use the filter name critetia.

  1. In the Data Source view, underneath Data, from the context menu on cc_data_view(prod:cja%3FFLATTEN), select Refresh. You need to refresh the connection to pick up the new filter you just defined in Customer Journey Analytics.

  2. 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 Hunting 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 [Daterange] dialog, select Range of dates, and select 01/01/2023 - 1/2/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 1. In the Explore interface of Looker, refresh your connection. Select Setting Clear cache and refresh.

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

  3. Select + Filter underneath Filters.

  4. In the Add Filter dialog:

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

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

  7. In the Add Filter dialog:

    1. Select ‣ Cc Data View
    2. From the list of fields, select ‣ Product Category.
  8. Ensure is as the selection for the filter.

AlertRed Lookes does not show the list of possible values for Product Category.

Looker count distinct

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

    code language-python
    data = %sql SELECT DISTINCT product_category FROM cc_data_view WHERE daterange BETWEEN '2023-01-01' AND '2024-01-01';
    style = {'description_width': 'initial'}
    category_filter = widgets.Dropdown(
       options=[d for d, in data],
       description='Product Category:',
       style=style
    )
    display(category_filter)
    
  2. Execute the cell. You should see output similar to the screenshot below.

    Jupyter Notebook Results

  3. Select Hunting 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 product_category = '{category_filter.value}' \
                GROUP BY 1 \
                ORDER BY Events DESC \
                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 an appropriate category. For examplee, Hunting.

    code language-r
    ## Dimension 1 Filtered by Dimension 2 value
    df <- dv %>%
       filter(daterange >= "2023-01-01" & daterange < "2023-02-01" & product_category == "Hunting") %>%
       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