cancel
Showing results for
Did you mean:
Highlighted
Helper III

## 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.

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

Accepted Solutions
Super User I

## Re: Calculated Column akin to COUNTIF

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!

4 REPLIES 4
Highlighted
Super User I

## Re: Calculated Column akin to COUNTIF

@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!

Highlighted
Helper III

## Re: Calculated Column akin to COUNTIF

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

Super User I

## Re: Calculated Column akin to COUNTIF

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!

Highlighted
Helper III

## Re: Calculated Column akin to COUNTIF

Perfect, thanks

Announcements

#### Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

#### Community Summit North America – Join Online!

Join this community-driven Power Platform digital event for unbiased support and problem-solving.

#### Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

#### Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Top Solution Authors
Top Kudoed Authors