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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Heonsang
Frequent Visitor

RANKX is not sequential

Hello,

 

I tried to create index field ordered by the date but it's not sequential as attached in the screenshot. Do you have any idea how to fix this?

Index = RANKX(Transmission,Transmission[Tx_Date],,ASC)
Capture.GIF
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Here's a measure that does the ranking on the fly:

[Index] =
if( HASONEVALUE( Transmission[Tx_Date] ),
	RANKX(
		ALLSELECTED( Transmission ),
		Transmission[Tx_Date],
		SELECTEDVALUE( Transmission[Tx_Date] ),
		ASC,
		Dense
	)
)

The above is relative to the selected dates. If you want to have an index (measure) that's absolute against the whole Transmission table, then you should use this:

[Index] =
if( HASONEVALUE( Transmission[Tx_Date] ),
	RANKX(
		ALL( Transmission ),
		Transmission[Tx_Date],
		SELECTEDVALUE( Transmission[Tx_Date] ),
		ASC,
		Dense
	)
)

If you want a calculated column, then... your formula works correctly, which I've checked. If you have a problem, then it most likely means your data type is not correct. Make sure you're using THE CORRECT DATA TYPES.

 

Best

D

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Here's a measure that does the ranking on the fly:

[Index] =
if( HASONEVALUE( Transmission[Tx_Date] ),
	RANKX(
		ALLSELECTED( Transmission ),
		Transmission[Tx_Date],
		SELECTEDVALUE( Transmission[Tx_Date] ),
		ASC,
		Dense
	)
)

The above is relative to the selected dates. If you want to have an index (measure) that's absolute against the whole Transmission table, then you should use this:

[Index] =
if( HASONEVALUE( Transmission[Tx_Date] ),
	RANKX(
		ALL( Transmission ),
		Transmission[Tx_Date],
		SELECTEDVALUE( Transmission[Tx_Date] ),
		ASC,
		Dense
	)
)

If you want a calculated column, then... your formula works correctly, which I've checked. If you have a problem, then it most likely means your data type is not correct. Make sure you're using THE CORRECT DATA TYPES.

 

Best

D

harshnathani
Community Champion
Community Champion

Hi @Heonsang ,

 

 

You can try,

 

Index = RANKX( ALL(Transmission),Transmission[Tx_Date],,ASC)

 

Regards,

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Pragati11
Super User
Super User

Hi @Heonsang ,

 

Are there any filters on this visual or on your page?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

There's no filter. I'm curious as duplicate index no is created also.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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