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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
AdamRobC
Helper II
Helper II

Circular dependency when sorting by column

Hi,

 

I would like to sort my month names by a calculated column based on the previous 12 month period. I have got the values populating in a suitable way using relative months to the current month.

 

MaxRelativeMonth = CALCULATE(MAX('Calendar'[RelativeMonth]),FILTER('Calendar','Calendar'[Monthly Reporting Period]="TY" && 'Calendar'[Month Name]='Month Ordering'[Month Name]))

 

reldate.PNG

 

However this keeps resulting in circular dependency errors. Any help?

 

Thanks,

Adam

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@AdamRobC , As you are using month name in creating the sort column you can not use that as a sort column

 

Create a column

Month Name 1 =[Month Name]

 

MaxRelativeMonth = CALCULATE(MAX('Calendar'[RelativeMonth]),FILTER('Calendar','Calendar'[Monthly Reporting Period]="TY" && 'Calendar'[Month Name]='Month Ordering'[Month Name]))

 

Sort Month Name 1 on the new sort column and use that is the visual. Do rename as per need

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@AdamRobC , As you are using month name in creating the sort column you can not use that as a sort column

 

Create a column

Month Name 1 =[Month Name]

 

MaxRelativeMonth = CALCULATE(MAX('Calendar'[RelativeMonth]),FILTER('Calendar','Calendar'[Monthly Reporting Period]="TY" && 'Calendar'[Month Name]='Month Ordering'[Month Name]))

 

Sort Month Name 1 on the new sort column and use that is the visual. Do rename as per need

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak thanks, that worked 🙂

AlB
Community Champion
Community Champion

@AdamRobC 

Ok, but you are using the Calendar table in the calculation as well.

Can you create that sorting column in Power query instead? That should avoid the issue.

Otherwise I'd need to see the calendar table its columns) and the its relationship with 'Month ordering'. If you can share the pbix, much better

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

 

AlB
Community Champion
Community Champion

Hi @AdamRobC 

When do you get the circular dependency error, when creating the calc column or when trying to "Sort by"?

Can you show the full table (columns)?

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

@AlB The error occurs when trying to sort Month Name by MaxRelativeMonth. That is the entire table, there are only 3 columns.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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