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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
qwertzuiop
Advocate III
Advocate III

Error: Ring dependency detected for second calculated column

Hello dear Power BI-Community

 

Following Problem.

 

Le'ts assume following table

qwertzuiop_0-1651138894234.png

Let's say we own 4 stores in different cities.

We have data on their "result sales" and "target sales" for the year.

 

Let's assume we would like to adjust the "result sale" and the "target sale" about minus amounts.


For "result sale":
There are also minus amounts in other stores, but for simplicity's sake we'll just assume London.

qwertzuiop_4-1651139496861.png


For "target sale"

qwertzuiop_5-1651139536253.png

More information, because I think the problem lies in the measure's itself

qwertzuiop_6-1651139709413.png

qwertzuiop_8-1651139738342.png

Any ideas how to solve the error?
Thank you so much for your support.

Cheers
qwertzuiop

 

 

 

 

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @qwertzuiop ,

 

If you want to create two adjusted columns for both Result and Target, please try:

Adjusted_Result = IF([Result / Target]="Result", CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Result")-200,0)
Adjusted_Target = IF([Result / Target]="Target", CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Target")-100,0)

Or just in a single column:

Adjusted = SWITCH([Result / Target],"Result",CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Result")-200,"Target",CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Target")-100,0)

 Output:

Eyelyn9_0-1651565997551.png

 

Best Regards,
Eyelyn Qin
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

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

Hi @qwertzuiop ,

 

If you want to create two adjusted columns for both Result and Target, please try:

Adjusted_Result = IF([Result / Target]="Result", CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Result")-200,0)
Adjusted_Target = IF([Result / Target]="Target", CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Target")-100,0)

Or just in a single column:

Adjusted = SWITCH([Result / Target],"Result",CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Result")-200,"Target",CALCULATE(SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[Store]),'Table'[Result / Target]="Target")-100,0)

 Output:

Eyelyn9_0-1651565997551.png

 

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

amitchandak
Super User
Super User

@qwertzuiop , You can not use measure in a calculated column

Thank you for your answer @amitchandak 

 

You helped but what is the alternative solution?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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