---
schema_version: "1"
id: 9977b72b10cdf74ab4e9fc554d782c161c07d5233c819cee043541e1d1079f0a
title: Measure Interactions
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_bindings/guides/bi-dashboard-bindings-wave-designer-use-case-measure.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-bindings/guide/bi-dashboard-bindings-wave-designer-use-case-measure.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7265e5e763d625b91dae40ade2a120398ce8dffb620569b0eb786df4c6a0a70e
products:
  - Analytics Interactions
  - analytics
---
# Measure Interactions

Bind the measure to allow the dashboard viewer to select which measures to show in a widget. For example, you can show different measures in a chart based on the selection in a toggle widget.

To dynamically set the measure in a query based on a selection, complete these tasks.

- Bind the `measures` property of the query.
- If the query is used for a chart, replace the `columnMap` section of the widget with an empty `columns` array. Why? Because when you change the query, the set of fields is different from what’s in the `columnMap` section. When you replace the `columnMap` property with an empty `columns` array, the system remaps the columns based on the new query definition.
- Binding isn’t allowed using the `columnMap` property.

Let’s look at an example where we bind the measure for a donut chart based on the selection in the toggle widget.

![The toggle widgets allow you to choose a measure to display in the map chart.](https://developer.salesforce.com/docs/media/bi_dev_guide_bindings/bi_212_chart_bindings.png)

The toggle widget uses this custom query.

```json
"MeasuresController_1": {
    "type": "staticflex",
    "label": "MeasuresController",
    "values": [
        {
            "display": "Total Amount",
            "step_property": [ "sum", "Amount" ]
        },
        {
            "display": "Average Amount",
            "step_property": [ "avg", "Amount" ]
        },
        {
            "display": "Count of Rows",
            "step_property": [ "count", "*" ]
        }
    ],
    "selectMode": "singlerequired",
    "start": {
        "display": [ "Total Amount" ]
    },
    "broadcastFacet": true,
    "groups": [],
    "numbers": [],
    "strings": []
}
```

Each toggle option has one display label (`display`) that appears in the toggle. It also has one value (`step_property`) that determines the measure.

Let’s bind the `step_property` field of the custom query (`MeasuresController_1`) to the measure in the donut chart’s step (`PieByProduct_2`). Any selection in the custom query passes the aggregation method (like sum or count) and the measure field to the `PieByProduct_2` query.

```json
"PieByProduct_2": {
    "label": "PieByProduct_2",
    "query": {
        "measures": [
            "{{ cell(MeasuresController_1.selection, 0, \\"step_property\\").asObject() }}"
        ],
        "groups": [ "Product" ]
    },
    "visualizationParameters": {

        ...

    },
    "receiveFacet": true,
    "selectMode": "single",
    "type": "aggregateflex",
    "isGlobal": false,
    "useGlobal": true,
    "broadcastFacet": true,
    "datasets": [
        {
            "id": "0FbB00000000q5gKAA",
            "label": "Flexy Sales",
            "name": "Flexy_Sales",
            "url": "/services/data/v42.0/wave/datasets/0FbB00000000q5gKAA"
        }
    ]
}
```

When you create the donut chart, by default, the widget (`chart_2`) contains the `columnMap` section that maps measures and groupings to chart attributes.

```json
"chart_2": {
    "type": "chart",
    "parameters": {
        "visualizationType": "pie",
        "step": "PieByProduct_2",
        "columnMap": {
            "trellis": [],
            "dimension": [ "Product" ],
            "plots": [ "sum_Amount" ]
        },

        ...

        }
    }
}
```

**note:** The properties under the `columnMap` property vary based on the chart type.

For the interaction to work correctly, replace the `columnMap` section with an empty `columns` array because interactions can’t be used to specify `columnMap`.

```json
"chart_2": {
    "type": "chart",
    "parameters": {
        "visualizationType": "pie",
        "step": "PieByProduct_2",
        "columns" : [],

        ...

        }
    }
}
```
