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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
aktripathi2506
Helper IV
Helper IV

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
Sean
Community Champion
Community Champion

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
Community Champion
Community Champion

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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Sean
Community Champion
Community Champion

an alternative to @KHorseman's solution above would be

 

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

 

2016-09-29 - Alt RowCount.png 

KHorseman
Community Champion
Community Champion

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? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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