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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Count number of rows whose year is greater than the year of the current row

Hi I have a table that looks like the following:

 

DateBarcode
01/10/2018ABC123
02/10/2019DEF456
03/10/2020GHI789
04/10/2021JKL123

 

 

I want to add a column that which counts the number of barcodes where the year of the row in the date column is greater than the year of the date column in my current row?

 

So it would look something like this:

 

DateBarcodeCount
01/10/2018ABC1233
02/10/2019DEF4562
03/10/2020GHI7891
04/10/2021JKL1230

 

Thank you in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , create a new column like

 


New column =
var _year = year([Date])
return
countx(filter(Table, year([Date])>_year),[barcode])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , create a new column like

 


New column =
var _year = year([Date])
return
countx(filter(Table, year([Date])>_year),[barcode])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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