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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Anonymous
Not applicable

Calculated column to get number of occurrences is returning values that squares the correct count

Hello.. I have been searching all day for an answer to my dilemma.  I wanted to get the count of how many times the value in a column appears in the column. I have found lots of solutions involving COUNTROW(FILTER formula that also involves EARLIER function. I am amazed that it has worked for a lot of the users who needed that solution.  But for some reason, it does not work for me.  The resulting value squares the correct count. 

 

To illustrate, for example I have below data.  Table name is "Data".  I want column B to return the count of occurrence of the ID in column A:
sample.JPG

 

So I made this formula in Power BI Desktop via a calculated column.  As you can see, the result is squaring the actual count:

result.JPG

 

I hope someone can help me with this.  Any possible reason why this is happening? And any solution for this?

 

Thanks in advance. 

 

1 ACCEPTED SOLUTION
BarnabasToth
Resolver I
Resolver I

It seems the implicit aggregation for the value was left on Sum.

Here are two approaches to address the issue with a sample file.

Regards

View solution in original post

2 REPLIES 2
BarnabasToth
Resolver I
Resolver I

It seems the implicit aggregation for the value was left on Sum.

Here are two approaches to address the issue with a sample file.

Regards

amitchandak
Super User
Super User

@Anonymous , Create a measure

countrows(filter(allselected(Table), Table[ID] =max(Table[ID]))

 

I think simple measure

countrows(Table)

 

should also work

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.