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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Unique count of rows in table in measure

Dear All,

 

I have a table in Power BI. Example below:

Power_BI_Adapt_0-1657718283964.png

 

I want to build a measure showing the number of customer numbers, which for instance could end up in the following output in power BI:

Power_BI_Adapt_1-1657718423254.png

 

3 rows do have customer number 1234

2 rows do have customer number 9876

1 rows does have customer number 1000

 

Name of mwasure in this example: 'Number of customer numbers'

 

Thanks!

 

Kind regards,

 

 

 

3 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi,
You can create a measure with the definition -> 

Count of Customer numbers = calculate(COUNT(Data[Customer Number]),ALLEXCEPT(Data,Data[Customer Number])) and you can get the required results.

View solution in original post

Anonymous
Not applicable

Thanks for your reply, however I dont get an unique count, but still a count of the total number of rows. Any other suggestion?

View solution in original post

Anonymous
Not applicable

Hi @Anonymous ,

 

As far as I konw, Avantika_Thakur 's code should work in your data model.

RicoZhou_0-1658135170392.png

Or you can try this code to create a calculated column.

CALCULATE(COUNT(Data[customer number]),FILTER(Data,Data[customer number] =EARLIER(Data[customer number])))

RicoZhou_1-1658135348479.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks for your reply, however I dont get an unique count, but still a count of the total number of rows. Any other suggestion?

Anonymous
Not applicable

Hi @Anonymous ,

 

As far as I konw, Avantika_Thakur 's code should work in your data model.

RicoZhou_0-1658135170392.png

Or you can try this code to create a calculated column.

CALCULATE(COUNT(Data[customer number]),FILTER(Data,Data[customer number] =EARLIER(Data[customer number])))

RicoZhou_1-1658135348479.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi,
You can create a measure with the definition -> 

Count of Customer numbers = calculate(COUNT(Data[Customer Number]),ALLEXCEPT(Data,Data[Customer Number])) and you can get the required results.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors