Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
VeljkoP98
Frequent Visitor

Filter metrics presented in different columns

Hello everyone,

 

I have multiple metrics in different columns, Column1=Metric1, Column2=Metric2 and etc. I would like to create some sort of measure called Metric Name which i could use to filter what metric i want to show on certain chart.

 

BR.

4 REPLIES 4
saudansari
Helper II
Helper II

Create a Parameter Table:
Start by creating a parameter table that contains a list of metric names. You can create a simple table with one column for Metric Name.


MetricName
-----------
Metric1
Metric2
Metric3
... (add more metrics)

Create a Slicer:
Add a slicer to your report based on the Metric Name column from the parameter table. This slicer will be used by users to select the metric they want to display.

Create a Measure:
Now, you need to create a measure that dynamically selects the chosen metric based on the user's selection. You can use the SWITCH function for this purpose.


SelectedMetric =
VAR SelectedMetricName = SELECTEDVALUE('ParameterTable'[MetricName])
RETURN
SWITCH (
SelectedMetricName,
"Metric1", [Metric1],
"Metric2", [Metric2],
"Metric3", [Metric3],
... (add more metrics)
)
Replace [Metric1], [Metric2], [Metric3], etc., with the actual column names that correspond to your metrics.

Create Visuals:
Now, you can use the SelectedMetric measure in your charts or visuals. When users select a metric from the slicer, the measure will dynamically switch to the corresponding metric column.

For example, if you create a card visual to display the selected metric, you would use the SelectedMetric measure in the Values field of the visual.

Thanks for suggestions, however, i am not able to enter [Metric1],[Metric2], etc in the SWITCH function...

You can also try to Create Measures for Each Metric:
For each metric (Metric1, Metric2, etc.), create a separate measure. Let's call them Measure_Metric1, Measure_Metric2, and so on.

Adjust the SWITCH statement in the SelectedMetric measure to reference the newly created measures:

SelectedMetric =
VAR SelectedMetricName = SELECTEDVALUE('ParameterTable'[MetricName])
RETURN
SWITCH (
SelectedMetricName,
"Metric1", [Measure_Metric1],
"Metric2", [Measure_Metric2],
"Metric3", [Measure_Metric3],
)
Make sure to replace [Measure_Metric1], [Measure_Metric2], [Measure_Metric3], etc., with the actual names of your measures.

Is there a particular error you are getting

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.