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
trevordunham
Resolver I
Resolver I

Sort by ascending with nulls from a relationship at the bottom

I have two tables, table 1 is a list of IDs and their details. Table 2 is a list of IDs and their rank. I have a relationship between these two tables based on ID. I want to sort all of the IDs and all of their details by the rank ascending with the nulls at the bottom, currently the nulls are at top by default. The nulls come from IDs in table 1 that are not in table 2. I tried to create a custom column that brings in 2 for all with rank null else 1 and sort by that. This doesn't work however as it is just bringing in nulls still for the custom column where rank is null for IDs in table 1 that are not in table 2.

 

Any ideas?

1 ACCEPTED SOLUTION
trevordunham
Resolver I
Resolver I

I was able to solve this with the following DAX:

 

RankFromTableA =
IF(
ISBLANK(RELATED('Table A'[Rank])),
MAX('Table A'[Rank]) + 1, 
RELATED('Table A'[Rank])
)

View solution in original post

2 REPLIES 2
trevordunham
Resolver I
Resolver I

I was able to solve this with the following DAX:

 

RankFromTableA =
IF(
ISBLANK(RELATED('Table A'[Rank])),
MAX('Table A'[Rank]) + 1, 
RELATED('Table A'[Rank])
)

Anonymous
Not applicable

Hi,@trevordunham 

 

We are glad that you have found a solution and are willing to share it, and accept your post for a solution, which is very helpful to our community, and community members who have the same problem as you will find a solution faster.

Thank you for your contribution to the community and wish you all the best in your work.

 

Best Regards,

Leroy Lu

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.