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 moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hello,
I am trying to create a COUNTROWS with a FILTER that has multiple critera. The criteria are that Decision Date has nothing in the column and that Case Date does not contain any date that is Christmas Day (25/12) in any year.
eg:
Solved! Go to Solution.
I would recommend something like this. I have rewritten slightly to filter specific columns.
I also suggest using KEEPFILTERS if you want to intersect the filters with any existing filters.
YourMeasure =
CALCULATE (
COUNTROWS ( 'BSP' ),
KEEPFILTERS ( ISBLANK ( 'BSP'[Decision Date] ) ),
KEEPFILTERS (
NOT ( MONTH ( 'BSP'[Case Date] ), DAY ( 'BSP'[Case Date] ) ) IN { ( 12, 25 ) }
)
)
Does this give the expected result?
I might also recommend adding a Date table for Case Date (at least) with a "flag" column to make filtering 25-Dec more convenient.
Regards
Your solution is great, @OwenAuger . It worked like a charm! Here I have another idea in mind, and I would like to share it for reference.
First of all, I think the reason your formula is reporting an error is that the FILTER function can only contain two arguments.
FILTER function (DAX) - DAX | Microsoft Learn
Here is my testing:
My sample:
1. Create two measures as follow
Measure =
IF (
MAX ( [Decision Date] ) <> BLANK ()
&& MONTH ( MAX ( [Case Date] ) = 12 && DAY ( MAX ( [Case Date] ) ) = 25 ),
0,
1
)
COUNT =
CALCULATE ( COUNT ( BSP[Case Date] ), FILTER ( BSP, [Measure] = 1 ) )
Result:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Your solution is great, @OwenAuger . It worked like a charm! Here I have another idea in mind, and I would like to share it for reference.
First of all, I think the reason your formula is reporting an error is that the FILTER function can only contain two arguments.
FILTER function (DAX) - DAX | Microsoft Learn
Here is my testing:
My sample:
1. Create two measures as follow
Measure =
IF (
MAX ( [Decision Date] ) <> BLANK ()
&& MONTH ( MAX ( [Case Date] ) = 12 && DAY ( MAX ( [Case Date] ) ) = 25 ),
0,
1
)
COUNT =
CALCULATE ( COUNT ( BSP[Case Date] ), FILTER ( BSP, [Measure] = 1 ) )
Result:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I would recommend something like this. I have rewritten slightly to filter specific columns.
I also suggest using KEEPFILTERS if you want to intersect the filters with any existing filters.
YourMeasure =
CALCULATE (
COUNTROWS ( 'BSP' ),
KEEPFILTERS ( ISBLANK ( 'BSP'[Decision Date] ) ),
KEEPFILTERS (
NOT ( MONTH ( 'BSP'[Case Date] ), DAY ( 'BSP'[Case Date] ) ) IN { ( 12, 25 ) }
)
)
Does this give the expected result?
I might also recommend adding a Date table for Case Date (at least) with a "flag" column to make filtering 25-Dec more convenient.
Regards
Thanks for the reply!
When it comes to setting the column I'd be looking for anything that is 25/12/... so what would be the best way to set that?
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Check out the November 2024 Power BI update to learn about new features.
User | Count |
---|---|
94 | |
90 | |
83 | |
75 | |
49 |
User | Count |
---|---|
145 | |
140 | |
109 | |
68 | |
55 |