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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
spagad6263
Post Patron
Post Patron

What is Filter used here for?

I've a table [test-data], and I would like to count how many records with field [PRE_CHECK] = "Y"). I've created measure as below. The difference is the second one has Filter, while the first one doesn't. They return same number of records. Just wondering what Filter is used here, and what difference it will make? Btw, the seconed one was written by anothre developer. Thanks.

 

mPre_Check = CALCULATE(DISTINCTCOUNT('test-data'[INVOICE_GUID]),'test-data'[PRE_CHECK] = "Y")

mPre_Check = CALCULATE(DISTINCTCOUNT('test-data'[INVOICE_GUID]),FILTER('test-data', 'test-data'[PRE_CHECK] = "Y"))

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

The FILTER() function is of no use in this scenario because yours is a simple filter condition (not a rich filter condition).  A rich filter condition is where you compare a measure to a measure, a measure to a column or a column to a column.  The second trigger for a filter is where you want to give precedence to the selection made in the slicer or to the field dragged in the rows/columns of a visual.  So in your example if you create a slicer for PRE_CHECK where the user selects "N" and you want the calculation to use "N" rather than "Y".  The FILTER() function gives precedence to the user selection rather than the filter condition mentioned in the CALCULATE() function. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
spagad6263
Post Patron
Post Patron

Thanks both for the advice.

Ashish_Mathur
Super User
Super User

Hi,

The FILTER() function is of no use in this scenario because yours is a simple filter condition (not a rich filter condition).  A rich filter condition is where you compare a measure to a measure, a measure to a column or a column to a column.  The second trigger for a filter is where you want to give precedence to the selection made in the slicer or to the field dragged in the rows/columns of a visual.  So in your example if you create a slicer for PRE_CHECK where the user selects "N" and you want the calculation to use "N" rather than "Y".  The FILTER() function gives precedence to the user selection rather than the filter condition mentioned in the CALCULATE() function. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.