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
jac88
Helper II
Helper II

How to add a measure as a filter? Not filtering correctly

Hello, 

 

I created a measure that I want to add as a filter, but it will not filter correctly. I want to filter instructor > 15 surveys. 

SurveyMeasure = CALCULATE(COUNT(SurveyAnalysis[Account]), ALL(SurveyAnalysis), VALUES(SurveyAnalysis[Instructor]))

 

jac88_0-1648708236965.png

Thank you so much

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Try using this measure as a filter:

filter = IF([Surveys] > 15, 1)

add it as a filter and set the value to = 1





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

It will still work. Create the measure:
Filter Surveys = IF(COUNT(Table[Surveys]) > 15, 1)

and add it to the filter for the visual in the filter pane and set the value to 1.

See this example

My filter measure:

Filter Count = 
IF(COUNT(Sales[Actuals]) >100, 1)

count actuals.jpg

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown 

 

Thank you so much for the quick response. Sorry if I confuse you, I don't want to hard code the number (I took 15 as an example.) 

I just want users to type  XX number of surveys in the filter. Is there any way I can change the hard code number to be the dynamic or user-entered number? 

 

Thank you so much 

PaulDBrown
Community Champion
Community Champion

Sure. First create a table to use as the slicer. Under Modeling in the ribbon, select new table and type in

Count Slicer =
VAR _Max =
    MAXX (
        VALUES ( SurveyAnalysis[Instructor] ),
        CALCULATE ( COUNT ( SurveyAnalysis[Account] ) )
    )
RETURN
    GENERATESERIES ( 1, _Max, 1 )

This creates a table of continuous values from 1 to the max count of accounts. In my example, I've called the table 'Count Slicer'

slicer.jpg

Create a slicer from this table, and in the dropdown, select "Greater or equal to "

dropdown.jpg

 

Now create the measure to use as the filte:

Count by slicer =
VAR _Min =
    MIN ( 'Count Slicer'[Value] )
VAR _Count =
    COUNT ( SurveyAnalysis[Account] )
RETURN
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( SurveyAnalysis[Instructor] ),
            FILTER ( SurveyAnalysis, _Count > _Min )
        )
    )

Add the measure to the filter pane and set the value to = 1
count by slicer.jpg

 

To get

Slicer.gif





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown 

Thank you so much. I never thought this would be a little complex and without you, I will never figure it out. Again, thank you so much, this works for me. 

PaulDBrown
Community Champion
Community Champion

Try using this measure as a filter:

filter = IF([Surveys] > 15, 1)

add it as a filter and set the value to = 1





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown   

 

Thank you for the response, I can not add Surveys to the filter. It's just a field that does a count. That's why I created a measure.

 

I want to measure to select values, I mean >15 or some other number. 

jac88_0-1648748019264.png

Any idea? Thank you so much 

 

 

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.