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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Carliniiiii
Frequent Visitor

Count based on distinct other column

Hello Power BI community,

 

I want to count the categories in a table per distinct identifier once. I can't remove the duplicates as they contain different data in other columns. 

 

Identifier Category
Title 1A
Title 1A
Title 1A
Title 2B
Title 2B
Title 3A
Title 3A
Title 4C

 

Desired Output 

A2
B1
C1

Ideally I can utilize the output directly in a pie chart to show the distribution of the categories whether be it in a measure or a separate column. 

 

Thank you all for your help. 

1 ACCEPTED SOLUTION
qqqqqwwwweeerrr
Super User
Super User

Hi   @Carliniiiii 

If my understanding is correct you want distinct count of identifier for a given category?

 

it can be direclty also in power in pie chart check below image
qqqqqwwwweeerrr_0-1717593031751.png

is identifier in value and take distinct count or you can create measure:

UniqueCategoryCount =
CALCULATE(
    DISTINCTCOUNT('Table'[Identifier ]),
    ALLEXCEPT('Table', 'Table'[Category])
)
qqqqqwwwweeerrr_1-1717593107946.png

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

View solution in original post

5 REPLIES 5
Carliniiiii
Frequent Visitor

Hi @qqqqqwwwweeerrr,

thank you for your help. Is there also a way to extract the category amount and represent it in a card? So for instance Title category = A, Amount 2 

 

Thanks

Hi @Carliniiiii 

 

If that answer helps you please mark that as an accpeted solution so other might use if they have similar problem. 

 

Seocnd: when you amount? is the same as count?or what like if category is B then what is expectation other than this do you want to only show A or B reason being Card will only take first value or total value or spefic manually given say only want to show value for A. I might have confused you but can please elobrate your question in detail with expected output and if any condition also want to included.

Regards

Hi @qqqqqwwwweeerrr 

 

"spefic manually given say only want to show value for A" 

 

I think this is the most accurate answer. Basically I want to create a card which represents the counted amount of category A based on the measure above. So the card says as callout value "2"

 

Thanks

Hi @Carliniiiii 

 

You can use this measure 

UniqueCategoryACount =
CALCULATE(
    DISTINCTCOUNT('Table'[Identifier ]),
    'Table'[Category] = "A"
)
qqqqqwwwweeerrr_0-1717608261912.png

let me know if doesnot works

Regards
 
qqqqqwwwweeerrr
Super User
Super User

Hi   @Carliniiiii 

If my understanding is correct you want distinct count of identifier for a given category?

 

it can be direclty also in power in pie chart check below image
qqqqqwwwweeerrr_0-1717593031751.png

is identifier in value and take distinct count or you can create measure:

UniqueCategoryCount =
CALCULATE(
    DISTINCTCOUNT('Table'[Identifier ]),
    ALLEXCEPT('Table', 'Table'[Category])
)
qqqqqwwwweeerrr_1-1717593107946.png

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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