[release-12.1.2] Docs: Add panel filtering (#110910)

Co-authored-by: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com>
Co-authored-by: Sam Jewell <2903904+samjewell@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot] 2025-09-10 15:55:22 -04:00 committed by GitHub
parent f8fcd6b2fb
commit 8b83e016ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 44 additions and 5 deletions

View File

@ -307,16 +307,20 @@ groupByNode(summarize(movingAverage(apps.$app.$server.counters.requests.count, 5
## Add ad hoc filters
_Ad hoc filters_ are one of the most complex and flexible variable options available.
Instead of a regular list of variable options, this variable allows you to build a dashboard-wide ad hoc query.
Instead of creating a variable for each dimension by which you want to filter, ad hoc filters automatically create variables (key/value pairs) for all the dimensions returned by your data source query.
This allows you to apply filters dashboard-wide.
Ad hoc filters let you add label/value filters that are automatically added to all metric queries that use the specified data source.
Unlike other variables, you don't use ad hoc filters in queries.
Instead, you use ad hoc filters to write filters for existing queries.
{{< admonition type="note" >}}
Not all data sources support ad hoc filters.
Examples of those that do include Prometheus, Loki, InfluxDB, and Elasticsearch.
{{< /admonition >}}
The following data sources support ad hoc filters:
- Prometheus
- Loki
- InfluxDB
- Elasticsearch
- OpenSearch
To create an ad hoc filter, follow these steps:
@ -333,6 +337,25 @@ To create an ad hoc filter, follow these steps:
Now you can [filter data on the dashboard](ref:filter-dashboard).
### Dashboard drilldown with ad hoc filters
In table visualizations, you can apply ad hoc filters from the visualization with one click.
To quickly filter the dashboard data, follow these steps:
1. Hover your cursor over the cell with the value you want to filter for to display the filter icons. In this example, the cell value is `ConfigMap Updated`, which is in the `alertname` column:
{{< figure src="/media/docs/grafana/panels-visualizations/screenshot-ad-hoc-filter-icon-v12.png" max-width="750px" alt="Table with ad hoc filter icon displayed on a cell" >}}
1. Click the add filter icon.
The variable pair `alertname = ConfigMap Updated` is added to the ad hoc filter and all panels using the same data source are filtered by that value:
{{< figure src="/media/docs/grafana/panels-visualizations/screenshot-ad-hoc-filter-applied-v12.2.png" max-width="750px" alt="Two tables, filtered" >}}
Panels in the dashboard that use the same data source but don't include the column value won't have any data remaining to display once the filter has been applied. In this example, the variable pair `_name_ = ALERTS` has been added to the ad hoc filter, so one of the tables doesn't return any results:
{{< figure src="/media/docs/grafana/panels-visualizations/screenshot-ad-hoc-filter-no-data-v12.2.png" max-width="750px" alt="Two tables, one filtered and one returning no results" >}}
<!-- vale Grafana.Spelling = YES -->
<!-- vale Grafana.WordList = YES -->

View File

@ -175,6 +175,22 @@ Columns with filters applied have a blue filter displayed next to the title.
To remove the filter, click the blue filter icon and then click **Clear filter**.
<!-- vale Grafana.WordList = NO -->
<!-- vale Grafana.Spelling = NO -->
### Apply ad hoc filters from the table
In table visualizations, you can apply ad hoc filters from the visualization with one click.
Hover your cursor over the cell with the value you want to filter for to display the filter icons:
{{< figure src="/media/docs/grafana/panels-visualizations/screenshot-table-adhoc-filter-v12.2.png" max-width="500px" alt="Table with ad hoc filter icon displayed on a cell" >}}
For more information about applying ad hoc filters this way, refer to [Dashboard drilldown with ad hoc filters](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/dashboards/variables/add-template-variables/#dashboard-drilldown-with-ad-hoc-filters).
<!-- vale Grafana.Spelling = YES -->
<!-- vale Grafana.WordList = YES -->
## Sort columns
Click a column title to change the sort order from default to descending to ascending.