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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Kbal
Regular Visitor

ALLEXCEPT + USERELATIONSHIP

Hi,


I have the following model :
Model.PNG
In the table KM_Final, I have a circular dependancy between 2 calculated columns :

PFS2_Count = 
var records = CALCULATE(COUNT('treatments'[id]) ;USERELATIONSHIP('treatments'[PFS2_ProtoMonthsLine] ; KM_Final[ProtoMonthsLine]) ) RETURN IF(ISBLANK(records);0;records)

 

PFS2_Running = 
SUMX(
    FILTER(
        ALL(KM_Final)
        ;[ProtoMonthsLine] <= EARLIER([ProtoMonthsLine])
    )
;[PFS2_Count])

Circular.PNG

 

 

The PFS2_Running should cumulative SUM the PFS2_Count, in the same way as PFS_Running do it to PFS_Count :
Data.PNG

The following link, tell me to add an index (I did it in table treatment but no effect), or to use ALLEXCEPT :

https://www.sqlbi.com/articles/understanding-circular-dependencies/

So, in the first column PFS2_Count, I want to add : ALLEXCEPT(KM_Final ; KM_Final[PFS2_Running]) to avoid circular dependency.

But I don't know how to combine ALLEXCEPT and USERELATIONSHIP.

Doing this don't give me the good result in PFS2_Count:

TryPNG.PNG

Please someone have an idea?
Thank you,

1 ACCEPTED SOLUTION

HI @v-piga-msft

 

Thank you for your reply, I need a column instead of measure to reuse it in another column.

But i have found my error : I was wrongly using ALLEXCEPT to remove filter context from the specified column.

The solution in my case is to use ALL(KM_Final[PFS2_Running]), and the circular dependency dissapears :

 

Solution.PNG

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Kbal,

 

For your scenario, I'm afraid that if you add : ALLEXCEPT(KM_Final ; KM_Final[PFS2_Running]) to the first column PFS2_Count, it will still have the error.

 

For your case, I will suggest create PFS2_Running as a measure that should avoid the circular dependency.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @v-piga-msft

 

Thank you for your reply, I need a column instead of measure to reuse it in another column.

But i have found my error : I was wrongly using ALLEXCEPT to remove filter context from the specified column.

The solution in my case is to use ALL(KM_Final[PFS2_Running]), and the circular dependency dissapears :

 

Solution.PNG

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.