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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
PBE
Helper II
Helper II

Dynamic Row Numbering for PBI Table

Hi I have data which I will be filtering by Work Type. In this example A & B

 

PBE_1-1688663953239.png

What I want to do is add a Row No. Column which updates for different work types.

Examples below:-

Select A on slicer

PBE_2-1688664151807.png

It numbers the filtered rows 1 to 8

Select B on slicer

PBE_4-1688664293418.png

It numbers the filtered rows 1 to 5

Is there a way to do this in DAX?

 

Thank you for any help.

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@PBE In theory you could create a measure like this:

Row No Measure = 
  VAR __Table = ALLSELECTED('Table')
  VAR __ID = MAX( 'Table'[ID] )
  VAR __Result = COUNTROWS( FILTER( __Table, [ID] <= __ID ) )
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@PBE In theory you could create a measure like this:

Row No Measure = 
  VAR __Table = ALLSELECTED('Table')
  VAR __ID = MAX( 'Table'[ID] )
  VAR __Result = COUNTROWS( FILTER( __Table, [ID] <= __ID ) )
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks @Greg_Deckler that worked well

Thanks I'll give it a go

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors