cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Adding a new column to count the number of records

Hi,

 

Please consider following senario:

Data is:

 

NameDate
A01/09/2016
A02/09/2016
A03/09/2016
A04/09/2016
A05/09/2016
B01/09/2016
B01/09/2016
B02/09/2016
B02/09/2016
B02/09/2016
B03/09/2016
C05/09/2016
D02/09/2016
E03/09/2016
F04/09/2016
F04/09/2016

 

I want to add a new column to it to have the total number of rows per individual. I don't want measure, I want a column. With measure I know how to do it. my need is with column.

 

Desired output is:

 

NameDateCount
A01/09/20165
A02/09/20165
A03/09/20165
A04/09/20165
A05/09/20165
B01/09/20166
B01/09/20166
B02/09/20166
B02/09/20166
B02/09/20166
B03/09/20166
C05/09/20161
D02/09/20161
E03/09/20161
F04/09/20162
F04/09/20162

 

Please advise.

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Sean Super Contributor
Super Contributor

Re: Adding a new column to count the number of records

an alternative to @KHorseman's solution above would be

 

Alt RowCount = CALCULATE ( COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[Name]) ) 

 

2016-09-29 - Alt RowCount.png 

View solution in original post

3 REPLIES 3
KHorseman Super Contributor
Super Contributor

Re: Adding a new column to count the number of records

RowCount = CALCULATE(
	COUNTROWS(TableName),
	FILTER(
		ALL(TableName),
		TableName[Name] = EARLIER(TableName[Name])
	)
)

Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!
Highlighted
Sean Super Contributor
Super Contributor

Re: Adding a new column to count the number of records

an alternative to @KHorseman's solution above would be

 

Alt RowCount = CALCULATE ( COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[Name]) ) 

 

2016-09-29 - Alt RowCount.png 

View solution in original post

KHorseman Super Contributor
Super Contributor

Re: Adding a new column to count the number of records

Oh yeah, that works too. I've had to do this in a few of my reports recently, but it usually has some other complicated conditions that made the ALLEXCEPT method much messier to write, so I sort of forgot it was an option.


Did I answer your question? Please mark it as a solution.

Proud to be a Datanaut!

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (2,159)