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
Anonymous
Not applicable

Trying to count the number of times a value from one column appears while filtered a certain way

Data looks like this:

 

 

Column A           Column B

asdf                     no

adsf                     yes

adsf                     no

czcz                     yes

czcz                     yes

 

I want to count the "yes" values and i want to add a calculated column (Column C) that looks like this below where the # of yes's for a given value in column A is shown for all of those values if it repeats:

 

Column A        Column C

asdf                     1

adsf                     1

adsf                     1

czcz                     2

czcz                     2

 

Thanks in advance...

2 ACCEPTED SOLUTIONS
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this column expression, replacing Table with your actual table name.

 

Yes Count =
CALCULATE (
    COUNT ( Table[ColumnA] ),
    ALLEXCEPT (
        Table,
        Table[ColumnA]
    ),
    Table[ColumnB] = "yes"
)

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Try his calculated column formula

=CALCULATE(CALCULATE(COUNTROWS(Data),Data[Reply]="yes"),FILTER(Data,Data[Text]=EARLIER(Data[Text])))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Try his calculated column formula

=CALCULATE(CALCULATE(COUNTROWS(Data),Data[Reply]="yes"),FILTER(Data,Data[Text]=EARLIER(Data[Text])))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this column expression, replacing Table with your actual table name.

 

Yes Count =
CALCULATE (
    COUNT ( Table[ColumnA] ),
    ALLEXCEPT (
        Table,
        Table[ColumnA]
    ),
    Table[ColumnB] = "yes"
)

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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