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
Dellis81
Continued Contributor
Continued Contributor

Using measure as a filter

Hello, I am wanting to use a measure inside a visual filter - and have seen referenced numerous times.

 

Below is my measure - returning either a 0 or 1.  The measure works as expected when viewed from a Card Visual

CostCalculatorHOVFilter = if(HASONEVALUE(CostCalculatorGroup[CostCalculatorGroup]),1,0)

However, when I place as a visual filter, I have no option to change (or enter) the criteria or value (circled in red)

VisualFilter.PNG

I have seen this filter demonstrated in numerous videos, and in my forum research, one interesting solution was to change the form.  I was unable to follow the logic.

 

I have also attempted a true/false filter but no success.

 

Any quick thoughts on how I might move forward?

thank you!

1 ACCEPTED SOLUTION
MatthRichardsUK
Resolver I
Resolver I

I apologize for the confusion. When you add a measure to the visual filters pane and select it, you should see a list of filter options displayed below the measure name. These options will vary depending on the type of data that the measure is returning.

For example, if the measure is returning a numeric value, you might see options such as "Greater than or equal to" or "Less than or equal to". If the measure is returning a text value, you might see options such as "Contains" or "Does not contain".

If you are unable to select these options or enter a value, it could be that the measure is not returning the expected data type. For example, if the measure is returning a text value, but the filter options are expecting a numeric value, the options will not be selectable.

To resolve this issue, you can try changing the data type of the measure by using the DAX function CONVERT, or by using the Format property in the Modeling tab of the Power BI ribbon.

I hope this helps! 

View solution in original post

5 REPLIES 5
theov
Advocate II
Advocate II

HASONEFILTER or HASONEVALUE are useful for total lines or heirarchy (and in that case I'd put inside the calculating measure). Your measure itself should be able to not bring categories for which the measure is empty.

In any case here a great video on how to use measure filters:
https://www.youtube.com/watch?v=Ss5L7jXIhso

MatthRichardsUK
Resolver I
Resolver I

I apologize for the confusion. When you add a measure to the visual filters pane and select it, you should see a list of filter options displayed below the measure name. These options will vary depending on the type of data that the measure is returning.

For example, if the measure is returning a numeric value, you might see options such as "Greater than or equal to" or "Less than or equal to". If the measure is returning a text value, you might see options such as "Contains" or "Does not contain".

If you are unable to select these options or enter a value, it could be that the measure is not returning the expected data type. For example, if the measure is returning a text value, but the filter options are expecting a numeric value, the options will not be selectable.

To resolve this issue, you can try changing the data type of the measure by using the DAX function CONVERT, or by using the Format property in the Modeling tab of the Power BI ribbon.

I hope this helps! 

v-shex-msft
Community Support
Community Support

Hi @Dellis81,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
MatthRichardsUK
Resolver I
Resolver I

It sounds like you want to use the CostCalculatorHOVFilter measure as a visual filter in a Power BI report.

To use a measure as a visual filter in Power BI, you need to do the following:

  1. Create the measure using a DAX formula, as you have done.
  2. Add the measure to the visual filters pane for the visual that you want to filter.
  3. Select the measure from the list of available filters in the visual filters pane.
  4. Set the filter criteria for the measure using the options provided in the visual filters pane.

Once you have done these steps, the visual will be filtered based on the criteria that you set for the measure.

If you are unable to see the measure in the list of available filters in the visual filters pane, make sure that the measure is being displayed in the Fields pane for the table or matrix that the visual is based on. If the measure is not listed in the Fields pane, you can add it by right-clicking on the table or matrix and selecting "Add Measure".

I hope this helps! Let me know if you have any questions.

Thanks for the response... Yes, I understand the steps needed, but your step 4 is where I get hung up.   The visual filter drop down options are not selectable nor am I able to enter a selection criteria.  The items circled in red in original post are not selectable/actionable.

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.