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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
carrollag
New Member

COUNTIF IN DAX with filters

I am new to PowerBI and am trying to figure out how to convert the below formula into DAX. This formula is being used to filter and pull a total count from multiple columns located within one very large report.  

 

=SUM(COUNTIFS('REG Major Reports Combined'!G:G, "Y", 'REG Major Reports Combined'!H:H, "MAT", 'REG Major Reports Combined'!I:I, "MEC"), COUNTIFS('REG Major Reports Combined'!G:G, "Y", 'REG Major Reports Combined'!Q:Q, "MAT", 'REG Major Reports Combined'!R:R, "MEC"))

 

Thanks! 

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

Hi, @carrollag ;

You could create a measure as follows:

count =
COUNTROWS (
    FILTER ( 'REG Major Reports Combined', [G] = "Y" && [H] = "MAT" && [I] = "MEC" )
)
    + COUNTROWS (
        FILTER ( 'REG Major Reports Combined', [G] = "Y" && [Q] = "MAT" && [R] = "MEC" )
    )

Best Regards,
Community Support Team_ Yalan Wu
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

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @carrollag ;

You could create a measure as follows:

count =
COUNTROWS (
    FILTER ( 'REG Major Reports Combined', [G] = "Y" && [H] = "MAT" && [I] = "MEC" )
)
    + COUNTROWS (
        FILTER ( 'REG Major Reports Combined', [G] = "Y" && [Q] = "MAT" && [R] = "MEC" )
    )

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ValtteriN
Super User
Super User

Hi,

So you want a sum of countifs? Here is one way to achieve this:

Example data:

ValtteriN_0-1643220519498.png


Dax:

Countifs = COUNTROWS(FILTER('Matrix example','Matrix example'[Material]="Wood"&&'Matrix example'[Item]="Item1"))
So here we count the rows where material is Wood and item is Item1


End result:
ValtteriN_1-1643220591086.png


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@carrollag , You can have measure like

countrows(filter('REG Major Reports Combined'[G] = "Y" && 'REG Major Reports Combined'[H] = "MAT" && 'REG Major Reports Combined'[I] = "MAT" ))

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.