Forum Discussion

Spacetronaut's avatar
Spacetronaut
New Member
2 years ago
Solved

How to filter displayed metrics dynamically

Hi,

 

I want to show different metrics in a line chart, however the scale is too different to make it easy to read:

 

Thus, I wanted to create a dropdown menu using a slicer, so I can select the metrics I want to display in my chart. The idea was to have something like this:

 

Here, I have a table listing the metrics:

KPIs Perfs segments = 
DATATABLE(
    "MetricName", STRING,
    {
        {"Sessions"},
        {"Intentions d'achats"},
        {"Conversions"},
        {"Taux de conversion"},
        {"Pages vues"},
        {"Taux de rebond"}
    }
)

 

And I add to my line chart (Y axis) my measure, which is the association between the "MetricName" list and the metrics to display:

SelectedMetricValue = 
SWITCH(
    SELECTEDVALUE('KPIs Perfs segments'[MetricName]),
    "Sessions", [Sessions (Somme) - GA],
    "Conversions", [Conversions (Somme)],
    "Taux de conversion", [Conversion (Taux)],
    "Intentions d'achats", SUM(analytics_perf[revenue]),
    "Taux de rebond", [Rebond (Taux) GA],
    "Pages vues", SUM(analytics_perf[page_views]),
    BLANK()
)

 

But, as you can see on the screenshot, the line chart is empty. Thus, I tried to add a scorecard as well to test each metric one by one instead of directly using a list, and this method is working great, but there's no point of having only one metric in a dropdown menu.

As an example with the Sessions only:

 

 

So each metric is working alone, but I have an empty value as soon as I add a new metric. I wonder if this has something to do with the fact that it says "SUM of SelectedMetricValue" when I add the measure to the chart's Y axis?

 

Any help would be greatly appreciated 🙂

Thanks!