Repository: evidentlyai/evidently
Issue: Clarification on GroupBy Usage in DashboardPanelPlot for Shipments Over Time by Customer
Root cause: Documentation Deficiency

Hello,

I'm using version 0.6.3 of Evidently. I'm working on visualizing shipments over time by customer using Evidently's DashboardPanelPlot. Here's the relevant snippet of my code:

```
import pandas as pd
from evidently.ui.dashboards import (
    DashboardPanelPlot,
    PanelValue,
    PlotType,
    ReportFilter
)
from evidently.future.metrics import RowCount

def create_or_update_project(workspace, project=None):
    # Add a panel for the number of shipments evaluated over time by customer
    project.dashboard.add_panel(
        DashboardPanelPlot(
            title="Shipments Evaluated Over Time by Customer",
            filter=ReportFilter(metadata_values={}, tag_values=[]),
            values=[
                PanelValue(
                    metric_fingerprint=RowCount().get_fingerprint(),
                    field_path="value",
                    legend="count",
                ),
            ],
            group_by='customer',
            plot_type=PlotType.BAR,
            size=2,
        )
    )

    project.save()
    return project
```

And

```
    project.dashboard.add_panel(
    DashboardPanelDistribution(
        title="Shipments Evaluated Over Time (by Carrier)",
        filter=ReportFilter(metadata_values={}, tag_values=[]),
        value=PanelValue(
            metric_fingerprint=UniqueValueCount(column="carrier").get_fingerprint(),
            field_path="counts"
        ),
        barmode=HistBarMode.GROUP,
        size=2
    ),
    tab="Overview"
)
```

I aim to display the number of shipments evaluated over time, grouped by customer. However, I'm uncertain if I'm utilizing the group_by parameter correctly, as the documentation on this topic is limited. In the [Migration Guide](https://docs.evidentlyai.com/faq/migration#new-reports-api) there is mention of

"Additional improvement: you can also now use “Group by” to compute metrics for specific segments."

Could you please confirm if this is the correct approach to achieve the desired visualization? Any guidance or examples would be greatly appreciated.

Thank you!

Hi @John-Sellers, 

this refers to the Metrics inside the Report (not the Dashboard). When you compute a Metric you can choose to group by a certain label. 

For example, this will compute the maximum value of salaries by each label in the "Department" column.

```
report = Report([
    GroupBy(MaxValue(column="Salary"), "Department"),
])
my_eval = report.run(data, None)
my_eval.dict()
```

This way you will have multiple Metrics inside your Report - and you can reference them on a Dashboard as usual. However, the dashboard itself is not running the query since it does not have access to the underlying data - only to the pre-computed results from inside the Reports.

@elenasamuylova 

Thank you for the quick response! That makes a lot more sense. How would I access the unique customers `metric_id` or `metric_fingerprint` from the `GroupBy` so that I could have them populate my bar or line graph?

Here is my metric:

```
            ##########################################################
            # Custom Metrics and Test
            ##########################################################
            IdealDayMetric(
                title="Ideal Day Percentage",
                target_column=definition.regression[0].target,
                pred_column=definition.regression[0].prediction,
                tests=[gte(35)]
            ),
            GroupBy(
                IdealDayMetric(
                    title="Ideal Day Percentage",
                        target_column=definition.regression[0].target,
                        pred_column=definition.regression[0].prediction,
                        tests=[gte(35)]
                    ), 
                "customer_name"
            ),
```

I'd like to add all the unique customers data points to my ` DashboardPanelPlot`:

```
    project.dashboard.add_panel(
        DashboardPanelPlot(
            title="Shipments Evaluated Over Time by Customer",
            filter=ReportFilter(metadata_values={}, tag_values=[]),
            values=[
                PanelValue(
                    metric_fingerprint=RowCount().get_fingerprint(),
                    field_path="value",
                    legend="count",
                ),
            ],
            group_by='customer',
            plot_type=PlotType.BAR,
            size=2,
        )
    )
```