You can dynamically set parts of a query based on the selection or results of another query. For example, you can set the grouping in a query based on the grouping selected in a chart.
Before we discuss how to bind the different parts of the query, let’s look at a comprehensive example. This example illustrates the interactions for different parts of a query. The chart is bound based on selections for grouping, measure, filter, order, and limit. When you make a selection in one of the toggle widgets, the chart changes to show the results of the modified query.

Here’s the JSON for the queries that power this dashboard. The Account_BillingCount_1 query is the underlying query for the chart widget. This query contains multiple interactions based on other queries.
"steps": {
"Account_BillingCount_1": {
"datasets": [
{
"id": "0FbB00000000oEkKAI",
"label": "Opportunities",
"name": "opportunity",
"url": "/services/data/v38.0/wave/datasets/0FbB00000000oEkKAI"
}
],
"isFacet": true,
"isGlobal": false,
"query": {
"measures": "{{column(StaticMeasureNames.selection, [\\"value\\"]).asObject()}}",
"limit": "{{column(StaticLimits.selection, [\\"value\\"]).asObject()}}",
"groups": "{{column(StaticGroupingNames.selection, [\\"value\\"]).asObject()}}",
"filters": "{{column(StaticFilters.selection, [\\"value\\"]).asObject()}}",
"order": "{{column(StaticOrdering.selection, [\\"value\\"]).asObject()}}"
},
"selectMode": "single",
"type": "aggregateflex",
"useGlobal": true,
"visualizationParameters": {
"visualizationType": "hbar",
"options": {}
}
},
"StaticGroupingNames": {
"datasets": [],
"dimensions": [],
"isFacet": true,
"isGlobal": false,
"selectMode": "single",
"start": {
"display": [
"Country"
]
},
"type": "staticflex",
"useGlobal": true,
"values": [
{
"display": "Country",
"value": "Account.BillingCountry"
},
{
"display": "Industry",
"value": "Account.Industry"
},
{
"display": "Product",
"value": "Product.Product.Family"
},
{
"display": "Source",
"value": "Account.AccountSource"
}
],
"visualizationParameters": {
"options": {}
}
},
"StaticFilters": {
"datasets": [],
"dimensions": [],
"isFacet": true,
"isGlobal": false,
"selectMode": "single",
"start": {
"display": "Ads Only"
},
"type": "staticflex",
"useGlobal": true,
"values": [
{
"display": "Ads Only",
"value": [
"LeadSource",
[
"Advertisement"
],
"in"
]
},
{
"display": "Partners Only",
"value": [
"Account.Type",
[
"Partner"
],
"in"
]
},
{
"display": "$1M+ Only",
"value": [
"Amount",
[
[
1000000,
11921896
]
],
">=<="
]
}
],
"visualizationParameters": {
"options": {}
}
},
"StaticOrdering": {
"datasets": [],
"dimensions": [],
"isFacet": true,
"isGlobal": false,
"selectMode": "single",
"start": {
"display": "Ads Only"
},
"type": "staticflex",
"useGlobal": true,
"values": [
{
"display": "Ascending",
"value": [
-1,
{
"ascending": true
}
]
},
{
"display": "Descending",
"value": [
-1,
{
"ascending": false
}
]
}
],
"visualizationParameters": {
"options": {}
}
},
"StaticLimits": {
"datasets": [],
"dimensions": [],
"isFacet": true,
"isGlobal": false,
"selectMode": "single",
"start": {
"display": [
"5"
]
},
"type": "staticflex",
"useGlobal": true,
"values": [
{
"display": "5",
"value": 5
},
{
"display": "10",
"value": 10
},
{
"display": "25",
"value": 25
}
],
"visualizationParameters": {
"options": {}
}
},
"StaticMeasureNames": {
"datasets": [],
"dimensions": [],
"isFacet": true,
"isGlobal": false,
"selectMode": "singlerequired",
"start": {
"display": [
"Total Amount"
]
},
"type": "staticflex",
"useGlobal": true,
"values": [
{
"display": "Max Employees",
"value": [
"max",
"Account.NumberOfEmployees"
]
},
{
"display": "Total Amount",
"value": [
"sum",
"Amount"
]
},
{
"display": "Avg Amount",
"value": [
"avg",
"Amount"
]
}
],
"visualizationParameters": {
"options": {}
}
},
"Account_AccountSourc_1": {
"datasets": [
{
"id": "0FbB00000000oEkKAI",
"label": "Opportunities",
"name": "opportunity",
"url": "/services/data/v38.0/wave/datasets/0FbB00000000oEkKAI"
}
],
"isFacet": true,
"isGlobal": false,
"query": {
"measures": [
[
"count",
"*"
]
],
"groups": [
"Account.AccountSource"
],
"order": [
[
-1,
{
"ascending": false
}
]
]
},
"type": "aggregateflex",
"useGlobal": true,
"visualizationParameters": {
"visualizationType": "hbar",
"options": {}
}
}
},
"widgetStyle": {
"backgroundColor": "#FFFFFF",
"borderColor": "#E6ECF2",
"borderEdges": [],
"borderRadius": 0,
"borderWidth": 1
}
note: If you bind a measure or grouping in a query used for a chart, you must also replace the columnMap section in the widget-level chart JSON with an empty columns array. For more information, see Measure Interactions and Group Interactions.