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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Count distinct values based on another column

Hello experts,

I'm just starting with Power BI and i cant get over one thing. I have a table with columns "Name" "Issue" "Status"
It looks like this:

 

NameIssueStatus

Name1

Test1Open
Name1Test2Open
Name1Test3Closed
Name2Test4Closed
Name2Test5Closed
Name2Test6Closed
Name2Test7Open
Name3Test8Closed

 

And i want a summary for each value in the Name column with count of the values in Status Column
Result should look like this:

NameOpenClosed
Name121
Name213
Name301


Any help there? I'm was searching through community posts but nothing worked for me

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need 2 measures as below:

Open = CALCULATE(COUNT('Table'[Status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[Status]="Open")
close = CALCULATE(COUNT('Table'[Status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[Status]="Closed")

Finally you will see:

Annotation 2020-02-13 140451.png

Or  you can  create a new table,using a dax expression as below:

 

 

Table 2 =
SUMMARIZE (
    'Table',
    'Table'[Name],
    "Open", CALCULATE (
        COUNT ( 'Table'[Status] ) + 0,
        ALLEXCEPT ( 'Table', 'Table'[Name] ),
        'Table'[Status] = "Open"
    ),
    "Close", CALCULATE (
        COUNT ( 'Table'[Status] ) + 0,
        ALLEXCEPT ( 'Table', 'Table'[Name] ),
        'Table'[Status] = "Closed"
    )
)

 

 

Finally,you will see:

Annotation 2020-02-13 135726.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need 2 measures as below:

Open = CALCULATE(COUNT('Table'[Status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[Status]="Open")
close = CALCULATE(COUNT('Table'[Status])+0,ALLEXCEPT('Table','Table'[Name]),'Table'[Status]="Closed")

Finally you will see:

Annotation 2020-02-13 140451.png

Or  you can  create a new table,using a dax expression as below:

 

 

Table 2 =
SUMMARIZE (
    'Table',
    'Table'[Name],
    "Open", CALCULATE (
        COUNT ( 'Table'[Status] ) + 0,
        ALLEXCEPT ( 'Table', 'Table'[Name] ),
        'Table'[Status] = "Open"
    ),
    "Close", CALCULATE (
        COUNT ( 'Table'[Status] ) + 0,
        ALLEXCEPT ( 'Table', 'Table'[Name] ),
        'Table'[Status] = "Closed"
    )
)

 

 

Finally,you will see:

Annotation 2020-02-13 135726.png

For the related .pbix file,pls click here.

 

Best Regards,
Kelly

Anonymous
Not applicable

Hi v-kelly-msft,

It worked, thanks for help

 

Best Regards,
ksusser

amitchandak
Super User
Super User

Try

Open = calculate(count(table[issue]),	table[Status]="Open")
Closed calculate(count(table[issue]),	table[Status]="Closed")
issue =count(table[issue])

 

The first two measures you can use in table or matrix with name in row.

The third one you can use in matrix name in row and issue in a col

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

 

 

 

 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

It's not working i am getting this result:

NameOpenClosed
Name135
Name235
Name335

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.