You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: explore-analyze/visualize/lens.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -184,6 +184,54 @@ Color mapping works best with fields that have a reasonable number of distinct v
184
184
185
185
When choosing colors, consider how they will appear in both light and dark themes. Use theme-aware neutral colors when you want to de-emphasize data.
186
186
187
+
### Show trends in Metric charts [metric-trends]
188
+
```{applies_to}
189
+
stack: ga 9.1
190
+
serverless: ga
191
+
```
192
+
193
+
When creating **Metric** visualizations with numeric data, you can add trend indicators that compare your primary metric to a secondary value. This feature displays colored badges with directional arrows to help you quickly identify whether values are increasing, decreasing, or staying the same.
194
+
195
+
| Without trend | With trend |
196
+
|--------|-------|
197
+
|||
198
+
199
+
To add trend indicators to your metric visualization:
200
+
201
+
1. Create a **Metric** visualization with a numeric primary metric.
202
+
2. Add a secondary metric that represents the comparison value.
203
+
204
+
::::{tip}
205
+
Use the `shift` parameter in formulas to compare current values against historical data. For example, if your primary metric is counting orders (based on an `order_id` field) for the current week, you can use the `count(order_id, shift='1w')` formula to compare this week's count of orders to last week's count.
206
+
::::
207
+
208
+
3. In the secondary metric configuration, look for the **Color by value** option. The possible choices are:
209
+
***None** — No trend indicators (default)
210
+
***Static** — Shows the secondary metric as a badge with a single color that you select
211
+
***Dynamic** — Enables both color coding and directional icons based on the comparison
212
+
213
+
4. Select **Dynamic** coloring. More options appear.
214
+
215
+
5. Choose a **Color palette** that matches how you'd like to represent the comparison.
216
+
217
+
6. Configure the **Display** option:
218
+
***Icon** — Shows only directional arrows: ↑ for increase, ↓ for decrease, = for no change
219
+
***Value** — Shows only the secondary metric value
220
+
***Both** — Shows both the icon and value (default)
221
+
222
+
7. The secondary metric does not automatically compare with the primary metric. Define the value to **Compare to**:
223
+
***Static value** — Compares against a fixed baseline value that you specify
224
+
***Primary metric** — Compares the secondary metric directly against the primary metric. This option is only available when the primary metric is numeric.
225
+
226
+
When you select this option, the secondary metric is automatically updated:
227
+
228
+
* The secondary metric label changes to **Difference**. You can change this by editing the **Prefix** option of the metric.
229
+
* If you chose a **Display** option that shows a value, the secondary metric value is automatically updated to show the difference compared to the primary metric.
230
+
231
+
7. Apply your changes.
232
+
233
+
The metric visualization is updated and now shows the secondary metric as a comparison with a trend indicator.
234
+
187
235
188
236
### Create visualizations with keyboard navigation [drag-and-drop-keyboard-navigation]
0 commit comments