> For the complete documentation index, see [llms.txt](https://docs.infotopics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.infotopics.com/drilldowntree/configuration/customize-measures/conditional-coloring.md).

# Conditional coloring

With conditional coloring, the color of each node depends on its values, for example green when sales and profit are on target and red when they are not. Open the **Conditional coloring** section of [Customize measures](https://docs.infotopics.com/drilldowntree/configuration/customize-measures.md) to set it up. The conditions apply to the measure you selected on the left.

<figure><img src="https://3696064508-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ffen81laUQFBf286HYARr%2Fuploads%2Fgit-blob-12cd5d851959285fd02a041a93f016948853039b%2FDDT_ConditionalColoring_Tree.png?alt=media" alt="Nodes colored by a Loss and a Profitable condition, with the legend" width="644"><figcaption></figcaption></figure>

## Add a condition

1. Enter a **Condition name**. This name is shown in the legend.
2. Write the condition:
   * Type `@` and pick a measure or custom calculation.
   * Compare it with a number or another measure, using `>`, `<`, `>=`, `<=` or `==` (equal to). Type them, or use the **>**, **<** and **≥** buttons.
   * Combine comparisons with `AND` and `OR`, for example `SUM(Sales) >= 1000 AND SUM(Profit) > 0`.
3. Click **Show color picker**, choose a color and click **Select**.
4. Click **Add condition**.

Repeat these steps for each color you need. Each condition appears as a chip under **Color conditions**.

<figure><img src="https://3696064508-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ffen81laUQFBf286HYARr%2Fuploads%2Fgit-blob-a654f446218e80b4a5663c7f605664c9a4984c37%2FDDT_ConditionalColoring_Chips.png?alt=media" alt="The operator buttons and the Color conditions chips" width="485"><figcaption></figcaption></figure>

Click a chip to change it, and then click \*\*Save Changes\*\*. Click the \*\*X\*\* on a chip to delete the condition.

{% hint style="info" %}
DrillDownTree checks the conditions in order. When a node meets more than one condition, the last condition in the list wins.
{% endhint %}

## Fallback and Other colors

Under **Color conditions** you also find two fixed chips:

* **Fallback color**: the color of nodes that don't meet any condition. Click the chip to change the color.
* **Other node color**: the color of the "Other" node.

Click the **X** on one of these chips to turn that color off. It is then also left out of the legend.

## Example

To show loss-making sub-categories in red and profitable ones in green, select **SUM(Profit)** and add two conditions:

| Condition name | Condition          | Color |
| -------------- | ------------------ | ----- |
| Loss           | `SUM(Profit) < 0`  | Red   |
| Profitable     | `SUM(Profit) >= 0` | Green |

Click **Save** in the dialog. The legend in your DrillDownTree now shows your condition names, followed by **FallBackColor** and **Other**. See the image at the top of this page for the result.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.infotopics.com/drilldowntree/configuration/customize-measures/conditional-coloring.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
