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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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])
)

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.