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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jl20
Helper IV
Helper IV

Calculated Column akin to COUNTIF

Hi,

 

I am trying to figure out a formula for a calculated column that will count the number of instances of a MatterID number (i.e., the red text in the screenshot below). Every "D" is on the table one time. Then, if the job becomes active, a new "E" record is created with the same MatterID. I searched the forum and could only find examples where multiple tables were involved.COUNTIF.JPG

 

This seems like it should be easy, but I can't seem to figure it out. Thank you in advance for your help.

1 ACCEPTED SOLUTION

To handle that, just wrap the original measure in an IF ISBLANK test:

 

=
IF (
    ISBLANK ( YourTable[MatterID] ),
    0,
    CALCULATE (
        COUNTROWS ( YourTable ),
        ALLEXCEPT ( YourTable, YourTable[MatterID] )
    )
)

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

4 REPLIES 4
OwenAuger
Super User
Super User

@jl20

A calculated column like this should to the trick:

 

=
CALCULATE ( 
    COUNTROWS ( YourTable ),
    ALLEXCEPT ( YourTable, YourTable[MatterID] )
)

Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

That worked, thanks for the quick reply! How would I modify so that if MatterID is blank, it returns a zero?

To handle that, just wrap the original measure in an IF ISBLANK test:

 

=
IF (
    ISBLANK ( YourTable[MatterID] ),
    0,
    CALCULATE (
        COUNTROWS ( YourTable ),
        ALLEXCEPT ( YourTable, YourTable[MatterID] )
    )
)

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Perfect, thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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