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

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
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!
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 Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)