Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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"))
Solved! Go to Solution.
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.
Thanks both for the advice.
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.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
90 | |
84 | |
70 | |
49 |
User | Count |
---|---|
143 | |
121 | |
112 | |
59 | |
58 |