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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
SivaMikkilineni
Frequent Visitor

Need a DAX for getting count with filter on 2 columns with OR condition on these 2 columns

Hi, I have a table as below

ProductCodeC_Alert

R_Alert

10110
10270
10300
10405
10500
10608
10730
10800

 

I need the count of ProductCode with below 2 condition 
- C_Alert >0 OR R_Alert>0
- C_Alert=0 AND R_Alert=0

So, the result I am expecting is Count as 5 with OR condition and Count as 3 with AND condition.

Can someone please help with a proper DAX for my requirement. I have tried to get the count by unable to use OR/AND conditions.  

6 REPLIES 6
FreemanZ
Super User
Super User

hi  @SivaMikkilineni

something like:

count  =
COUNTROWS(
    FILTER(
        TableName,
        OR(
            TableName[C_Alert]>0 || TableName[R_Alert]>0,
            TableName[C_Alert]=0 && TableName[R_Alert]=0
        )
    )
)

 

@FreemanZ This worked, Thanks a lot

tamerj1
Super User
Super User

Hi @SivaMikkilineni 
Are [C_Alert] and [R_Alert] measures or columns?

Hi @tamerj1 
ProductCode, C_Alert, R_Alert are column names

@SivaMikkilineni 
Assuming ProductCode is a primary key in the table you can use

=
COUNTROWS ( FILTER ( 'Table', 'Table'[C_Alert] > 0 || 'Table'[R_Alert] > 0 ) )
=
COUNTROWS ( FILTER ( 'Table', 'Table'[C_Alert] = 0 && 'Table'[R_Alert] = 0 ) )

Please let me know if otherwize

Hi @tamerj1 
Thanks for the reply, but can I get the result within a single DAX ?
Result should give me the ProductCount according to OR/AND condition

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.