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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mamoormasoomi
Helper I
Helper I

Compare text rows and return result in numeric

Hello, 

Please check the below screenshot and help me to resolve this issue.

Power BI.jpg

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@mamoormasoomi wrote:

Hello, 

Please check the below screenshot and help me to resolve this issue.

Power BI.jpg


@mamoormasoomi

To get the expected output, the first step is sorting by Key1 ascending and adding an index column to determine the rows order.

Capture.PNG

 

Then create a calculated column

Result Key = 'Table'[Index]-MINX(FILTER('Table',EARLIER('Table'[Key1])='Table'[Key1]),'Table'[Index])+1

Capture.PNG

 

See more details in the attached pbix file.

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee


@mamoormasoomi wrote:

Hello, 

Please check the below screenshot and help me to resolve this issue.

Power BI.jpg


@mamoormasoomi

To get the expected output, the first step is sorting by Key1 ascending and adding an index column to determine the rows order.

Capture.PNG

 

Then create a calculated column

Result Key = 'Table'[Index]-MINX(FILTER('Table',EARLIER('Table'[Key1])='Table'[Key1]),'Table'[Index])+1

Capture.PNG

 

See more details in the attached pbix file.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.