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
possible-possum
Frequent Visitor

Why am I getting a circular dependency error?

I am updating a report I created a long time ago to be more efficient. I am trying to swap out a long nested IF statement for a SWITCH statement in a table, but I keep running into an error.

 

I have three columns. The purpose of the columns is to calculate how long a project has been active for, and to sort the projects into time buckets for use in a visual.

 

Column one calculates the days the project has been active for:

possiblepossum_0-1666051013803.png

Column two sorts the project into a bucket based on column one:

possiblepossum_1-1666051104004.png

 

And the final column sorts the bucket labels of column two so the stacked bar chart I use to visualise the data shows the values in order.

possiblepossum_2-1666051128441.png

 

The end result looks a bit like this:

possiblepossum_3-1666051173959.png

 

I figure that it would be easy to swap the IF statements in column three to use SWITCH instead as the values are static scalar values, but I keep running into a circluar dependency error when I go to sort column two by column three and I can't work out why! 

 

New measure:
Age Sort =
SWITCH(
'Projects'[Age Undelivered Bucket],
"<30 Days", 1,
"30-60 Days", 2,
"60-90 Days", 3,
"3-6 Months", 4,
"6-9 Months", 5,
"9-12 Months", 6,
"1 Year +", 7
)

possiblepossum_4-1666051494805.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @possible-possum ,

I have created a simple sample, please refer to it to see if it helps you.

Create a column.

age sort11 =
SWITCH (
    TRUE (),
    Sheet2[Age undelivered Bucket] = "<30 Days", 1,
    Sheet2[Age undelivered Bucket] = "30-60 Days", 2,
    Sheet2[Age undelivered Bucket] = "60-90 Days", 3,
    Sheet2[Age undelivered Bucket] = "3-6 Months", 4,
    Sheet2[Age undelivered Bucket] = "6-9 Months", 5,
    Sheet2[Age undelivered Bucket] = "9-12 Months", 6,
    Sheet2[Age undelivered Bucket] = "1 Year +", 7
)

vpollymsft_0-1666056872914.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
kristel_tulio
Helper III
Helper III

Hi @possible-possum 

 

You can use SWITCH function

kristel_tulio_0-1666072874189.png

kristel_tulio_1-1666072891847.png

 

 



Anonymous
Not applicable

Hi @possible-possum ,

I have created a simple sample, please refer to it to see if it helps you.

Create a column.

age sort11 =
SWITCH (
    TRUE (),
    Sheet2[Age undelivered Bucket] = "<30 Days", 1,
    Sheet2[Age undelivered Bucket] = "30-60 Days", 2,
    Sheet2[Age undelivered Bucket] = "60-90 Days", 3,
    Sheet2[Age undelivered Bucket] = "3-6 Months", 4,
    Sheet2[Age undelivered Bucket] = "6-9 Months", 5,
    Sheet2[Age undelivered Bucket] = "9-12 Months", 6,
    Sheet2[Age undelivered Bucket] = "1 Year +", 7
)

vpollymsft_0-1666056872914.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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