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

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

Reply
oldrunner
Frequent Visitor

Filter duplicate values with more arguments

Hi,

I need to add another filter argument in my dax formular. 

Right now, I have the following:

Duplicate Cust. Ref = CALCULATE(

                                COUNT(

                                    'ABC'[DEF]

                                ),

                                Filter(

                                    'ABC',

                                    'ABC'[DEF]=EARLIER('ABC'[DEF)

                                )

)


Now I need to include also the column "ABC[XYZ]" as a second argument to filter. So I only need the count when both arguments are true.

 

Any help how I can achieve this?

Thanks

Alexander

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @oldrunner ,

 

The EARLIER function is usually used in calculated columns, please use the MAX or SELECTEDVALUE function in the measure, like this:

 

Duplicate Cust. Ref = 
CALCULATE ( 
    COUNT ( 'ABC'[DEF] ),
    Filter ( 'ABC', 'ABC'[DEF] = MAX ( 'ABC'[DEF] ) )
)

vkkfmsft_0-1648188280018.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

5 REPLIES 5
v-kkf-msft
Community Support
Community Support

Hi @oldrunner ,

 

The EARLIER function is usually used in calculated columns, please use the MAX or SELECTEDVALUE function in the measure, like this:

 

Duplicate Cust. Ref = 
CALCULATE ( 
    COUNT ( 'ABC'[DEF] ),
    Filter ( 'ABC', 'ABC'[DEF] = MAX ( 'ABC'[DEF] ) )
)

vkkfmsft_0-1648188280018.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

oldrunner
Frequent Visitor

I get the message that "earlier" functions cannot be nested. So, unfortunately, this did not work.
Maybe my question was not quite correct. I need to filter on two different columns and it should only count when both (or more) arguments are true. So for example the customer name and the purchase order number (as different customers might have the same purchase order number).
Thanks

Alex

oldrunner
Frequent Visitor

Thanks.
I get the message that earlier functions cannot be nested. Maybe my question was not quite correct. I need to filter on two different columns and it should only count when both (or more) arguments are true. So for example the customer name and the purchase order number (as different customers might have the same purchase order number).
Thanks

Alex

amitchandak
Super User
Super User

@oldrunner , Check the solution by @darshaningale . If that do not work try

 

Duplicate Cust. Ref = CALCULATE(
COUNT(
'ABC'[DEF]
),
Filter(
'ABC',
'ABC'[DEF]=EARLIER('ABC'[DEF)
&& ABC[XYZ] = earlier(ABC[XYZ])
)

)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
darshaningale
Resolver II
Resolver II

Duplicate Cust. Ref = CALCULATE(

                                COUNT(

                                    'ABC'[DEF]

                                ),

                                Filter(

                                    'ABC',

                                    'ABC'[DEF]=EARLIER('ABC'[DEF) && ABC[XYZ] ='something'

                                )

)

 

 

Regards
DI

Did I answer your question? Mark my post as a solution, this will help others!
Kudos are also welcome.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.