Tutorial: Aggregate Facet Values

When using the sales_store_country facet, we can refine on orders by countries. We now want to aggregate revenues for each country contained in the country facet.

Note: The Data Table widget used in this section is only available in Mashup Builder Premium.

This task shows you how to:

Add an Aggregation to the sales_store_country Facet

  1. In the Administration Console, select Search > Search Logics > sl0.
  2. Under the Facets section, expand sales_store_country.
  3. Expand Aggregations and specify the following:
    1. Id: Revenue
    2. Type: SUM
    3. Expression: (sales_unit_price * sales_quantity)
  4. Click Apply.

Configure the Display of the Facet Aggregation

  1. In Mashup Builder, select the /search page, and then select the Design view.
  2. From the Widgets panel, expand Tables and drag Data Table to the page so it is immediately above the Result List widget.
  3. Click the Data Table widget header and on the widget properties panel, specify the following:
    1. In Widget title, type Revenue by Country
    2. In Facet name, select sales_store_country (from the Values list on the left)

    Note: If you do not see this facet on this list, click the Reload icon at the top of the Values list.

  4. Select the Column tab.
    1. In Facet column title, type Country.
    2. In Columns, remove all the columns for count and score.
  5. Still in Columns, use the dynamic list on the left to add the following:

    Column 1:

    • Value: Revenue
    • Title: Revenue ($)
    • Display percentage: not selected

    Column 2:

    • Value: Revenue
    • Title: % of Total
    • Display percentage: selected



  6. Click Apply.

View Your Changes

  1. Go to the Mashup UI, and refresh the search page.



  2. Click a facet within the table to narrow your search results for one country.