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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MontherKH
Frequent Visitor

Adding values in RANKX Function

I have Employees table, and I want to create a measure that ranks them by adding the values of Salary and Bonus together then rank them, Salary and Bonus are columns in the table.

 

I wrote this DAX:

Profit Rank = RANKX('Employee Listing',[Salary (USD)] + [Bonus], , DESC)

 

and Power BI gives me this error:

The value for 'Salary (USD)' cannot be determined. Either the column doesn't exist, or there is no current row for this column.
1 ACCEPTED SOLUTION
MahyarTF
Memorable Member
Memorable Member

Hi

Is there some reason you created the Measure instead of the calculated column ?

your code is worked if you use it as a column.

 

Appreciate your Kudos and please select it if it is helps you

Mahyartf

View solution in original post

4 REPLIES 4
menglaro78
Microsoft Employee
Microsoft Employee

HI @MontherKH ,

I suggest this:

I think your columns Salary and Bonus are not saved in the same table Employee Listing.

So you can write Sum(Table[Salary USD]) + Sum(Table[Bonus]) in your Rankx expression or create a explicit measure before.

Furthermore i suggest to use ALL(Employee Listing'[Employee])

 

Profit Rank = RANKX(ALL('Employee Listing'[Employee]),sum('Table'[Salary (USD)]) + sum('Table'[Bonus]), , DESC)

 

RANKX - DAX Guide

 

Marco

They ARE in the same table, and I tried your formula but it gives all the employees rank 1

Are you using the all function?

 

Profit Rank = RANKX(ALL('Employee Listing'[Employee]),sum('Table'[Salary (USD)]) + sum('Table'[Bonus]), , DESC)

MahyarTF
Memorable Member
Memorable Member

Hi

Is there some reason you created the Measure instead of the calculated column ?

your code is worked if you use it as a column.

 

Appreciate your Kudos and please select it if it is helps you

Mahyartf

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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