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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Militambe3171
Frequent Visitor

Is there any way to create Metrics as a filter?

If i select a metric from filter, chart should get populated with data for selected metric for period

Similar like below image

 

Power bi query.png

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Militambe3171,

 

Assuming that you have a table like below.

Date Metric1 Matric2
1/1/2018 23 56
2/1/2018 78 98
3/1/2018 91 84
4/1/2018 61 33

Then you could Unpivot columns with Metric1 and Metric2 in Query Editor and your data model will like this:

 

after unpivot.PNG

 

After Close and Apply, you could create the slicer with Attricbute and create the line chart with value.

 

If you want to show the line chart blank when you don't select the matric in the silcer. You could create the measure with the formula below.

 

Measure = IF(ISFILTERED('Table2'[Attribute]),CALCULATE(SUM('Table2'[Value])),BLANK())

Here is the output.

 

Untitled.png

 

For more details, you coud refer to the attachment.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Militambe3171,

 

Assuming that you have a table like below.

Date Metric1 Matric2
1/1/2018 23 56
2/1/2018 78 98
3/1/2018 91 84
4/1/2018 61 33

Then you could Unpivot columns with Metric1 and Metric2 in Query Editor and your data model will like this:

 

after unpivot.PNG

 

After Close and Apply, you could create the slicer with Attricbute and create the line chart with value.

 

If you want to show the line chart blank when you don't select the matric in the silcer. You could create the measure with the formula below.

 

Measure = IF(ISFILTERED('Table2'[Attribute]),CALCULATE(SUM('Table2'[Value])),BLANK())

Here is the output.

 

Untitled.png

 

For more details, you coud refer to the attachment.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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