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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Countrows with multiple criteria

Hello everyone,

Thank you for your time, I'm struggling creating a measure, hopefully you guys can help me.
Basically it's a countifs in excel but I just can make it work in DAX. Here's an example in excel:

Measure.PNG

 

I need to replicate that in PBI (Measure, column in light blue). The problem is that I can't make it count each variable in the columns that I'm using, here's what I have so far:

measure =
COUNTROWS(
SUMMARIZE(
ALL('Table'),
'Table'[Customer ID],
'Table'[Date]
)

I tried using the grouby option but it would take away other columns that I need after this gets done. I highly appreciate any help given! Thank you for your time!

1 ACCEPTED SOLUTION
DavisBI
Solution Specialist
Solution Specialist

Hi, @Anonymous ,

 

In this case you need to use EARILER().  (see screenshot below)

 

20201022103906.png

 

Column = 
CALCULATE (
    COUNT ( Sheet1[Date] ),
    'Sheet1'[Customer ID] = EARLIER ( Sheet1[Customer ID] ),
    'Sheet1'[Date] = EARLIER ( Sheet1[Date] ),
    ALL ( Sheet1 )
)

Mark this post as solution if this helps,thanks! 

View solution in original post

3 REPLIES 3
DavisBI
Solution Specialist
Solution Specialist

Hi, @Anonymous ,

 

In this case you need to use EARILER().  (see screenshot below)

 

20201022103906.png

 

Column = 
CALCULATE (
    COUNT ( Sheet1[Date] ),
    'Sheet1'[Customer ID] = EARLIER ( Sheet1[Customer ID] ),
    'Sheet1'[Date] = EARLIER ( Sheet1[Date] ),
    ALL ( Sheet1 )
)

Mark this post as solution if this helps,thanks! 

Anonymous
Not applicable

Davis!

Thank you so much for your help! This is exactly what I was looking for!

saumitra
Helper I
Helper I

Hi @DavisBI

I also have a similar problem, however I am not getting the desired outcome from the solution that you provided. I am attaching a screenshot, kindly please take a look at it. 

saumitra_0-1614155336290.png

So what I want is that, if Ash's name pops up for the first time for Forbes then the count should be 1. However, if it again pops up for the same company i.e. Forbes for Ash, then I want it to count as 2, as it is coming for the 2nd time and so on. 

I am attaching an excel sample also, for you to understand what excel formulae I am using. 

saumitra_1-1614155479296.png

saumitra_2-1614155516660.png

saumitra_3-1614155549371.png

I hope this helps. Kindly please help. I am also open to alternate solutions.

Thank you,

Regards,

Saumitra Upadhyaya

 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

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

Users online (27)