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
clarkpaul
Helper I
Helper I

Error when using a column to sort another column

I have a list of values in a filter that need to be sorted.  I created a sort table:

clarkpaul_0-1731944556562.png

I joined it to my table:

clarkpaul_1-1731944655113.png

 

I created a new column in my data table "Location_SortB = related('Alt Loc Sort'[Sort Order])"

I highlight Alt Loc (groups) in the field list then choose "Sort by Column" and choose Location_SortB

clarkpaul_2-1731944874489.png

 

I get the error message:

clarkpaul_3-1731944932619.png

I created a table to make sure that there are not more than one sort order number per item:

clarkpaul_4-1731945172811.png

Any idea what I'm doing wrong?

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file and show the problem clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
clarkpaul
Helper I
Helper I

There are no blank values.  I also broke the relationship to the sort table and the data table and used lookup to get the sort values.  They come across correctly but when I try to apply the sort column to the data, I get a circular dependency error.

@clarkpaul , LOOKUPVALUE() function will result in a circular dependency since you might have used Location column within your search field. Try fixing using RELATED() funtion or create a Sort Column at power query level by merging the queries.

 

Thanks,

Jai




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





johnt75
Super User
Super User

The problem is the relationship. Because it is a one-to-many, that could result in a blank row being silently added to the one-side in the event that rows appear in the many side which don't exist in the one-side.

You can try deleting the relationship and instead of using RELATED use LOOKUPVALUE instead.

That might not work, again because of possible blank values in the lookup table. If that is the case you would need to create the sort order column directly on the target table, probably using SWITCH to define logic.

MFelix
Super User
Super User

Hi @clarkpaul ,

 

Try to check if there are any blanks on that new Location_SortB column and you try to do a sort by and there are blank values it does not accept to do the sorting.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.