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

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

Reply
cpatton10
Frequent Visitor

Help with a CountIf function in Power BI

Hello!

 

I have a Countif function in Excel that I need to replicate in PowerBI. 

 

Excel function: Countifs(B:B,B1,C:C,"Date In Service")

A        B                           C
2       Project A          Date In Service
1       Project B          Date In Service
1       Project C          Date In Service
1       Project D          Date In Service
2 Project A Date In Service

 

Essentially the excel function is counting how many "dates in service" there are per project. 

Column a is the output of the formula. 

 

I need help creating a similar DAX function.

 

Thank you!

3 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@cpatton10 

why 2 for project A? We only see one Date in Service for project A.

 

pls see if this is what you want

 

Column = countx(FILTER('Table','Table'[B]=EARLIER('Table'[B])&&'Table'[C]="Date In Service"),'Table'[B])
11.png
 

 

 





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

Proud to be a Super User!




View solution in original post

You can create a calculated column like that in your table
Please see, if this is what you want

ColumnA =
CALCULATE(
    COUNTROWS(Project),
    FILTER(
        Project,
        Project[ColumnB] = EARLIER(Project[ColumnB]) &&
        Project[ColumnC] = "Date In Service"
    )
)

muhammad_786_1_1-1724203713452.png

 

View solution in original post

Anonymous
Not applicable

Hi @cpatton10 

 

Thanks for the reply from ryan_mayu and muhammad_786_1.

 

@cpatton10 , you can create a calculated column as follows

Column = CALCULATE(COUNT('Table'[B]), FILTER(ALLEXCEPT('Table', 'Table'[B]), [C] = "Date In Service"))

 

Output:

vxuxinyimsft_0-1724227147251.png

 

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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @cpatton10 

 

Thanks for the reply from ryan_mayu and muhammad_786_1.

 

@cpatton10 , you can create a calculated column as follows

Column = CALCULATE(COUNT('Table'[B]), FILTER(ALLEXCEPT('Table', 'Table'[B]), [C] = "Date In Service"))

 

Output:

vxuxinyimsft_0-1724227147251.png

 

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.

ryan_mayu
Super User
Super User

@cpatton10 

why 2 for project A? We only see one Date in Service for project A.

 

pls see if this is what you want

 

Column = countx(FILTER('Table','Table'[B]=EARLIER('Table'[B])&&'Table'[C]="Date In Service"),'Table'[B])
11.png
 

 

 





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

Proud to be a Super User!




You can create a calculated column like that in your table
Please see, if this is what you want

ColumnA =
CALCULATE(
    COUNTROWS(Project),
    FILTER(
        Project,
        Project[ColumnB] = EARLIER(Project[ColumnB]) &&
        Project[ColumnC] = "Date In Service"
    )
)

muhammad_786_1_1-1724203713452.png

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors