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

fixing circular reference in calculated column

Hello. 

 

I'm getting a circular reference I can't figure out how to fix when creating a calculated column version of a calculated measure.

Here is my workbook Airport code workbook (wetransfer link).

 

I've had some community help (thanks!) to get my calculated measure Result Destination working, but becuase I want to link two tables, I need it to be a calculated column instead. 

 

In the workbook I have the table setup exactly with the correct output. The circular reference is in a calculated column called Result Destination Col. I want to fix that and then replace the Result Desination measure with this column in my visualization.

 

Thanks so much.

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

Hi @Dudeman   ;

 

When you use Live connection, you can not add columns,  So maybe you could try to modify the MaxArrival2 column by the following formula:

MaxArrival2 =
CALCULATE (
    MAX ( 'Legs'[arrivalTime] ),
    FILTER (
        ALL ( 'Legs' ),
        [BookingNumber] = EARLIER ( [BookingNumber] )
            && [ArrivalDate] = EARLIER ( [ArrivalDate] )
    )
)

The final output is shown below:  

v-yalanwu-msft_1-1622707212067.png

Best Regards,
Community Support Team_ Yalan Wu
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

5 REPLIES 5
v-yalanwu-msft
Community Support
Community Support

Hi @Dudeman   ;

 

When you use Live connection, you can not add columns,  So maybe you could try to modify the MaxArrival2 column by the following formula:

MaxArrival2 =
CALCULATE (
    MAX ( 'Legs'[arrivalTime] ),
    FILTER (
        ALL ( 'Legs' ),
        [BookingNumber] = EARLIER ( [BookingNumber] )
            && [ArrivalDate] = EARLIER ( [ArrivalDate] )
    )
)

The final output is shown below:  

v-yalanwu-msft_1-1622707212067.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

v-yalanwu-msft
Community Support
Community Support

Hi @Dudeman  , 

 

You could create two columns by the following formula: 

MaxArrival2 = CALCULATE(MAX( 'Legs'[arrivalTime]),ALLEXCEPT ('Legs','Legs'[BookingNumber],'Legs'[ArrivalDate]))
Result Destination 2 =
IF (
    [arrivalTime]
        = CALCULATE (
            MIN ( [arrivalTime] ),
            FILTER (
                ALLEXCEPT ( Legs, Legs[BookingNumber] ),
                [arrivalTime] = [MaxArrival2]
            )
        ),
    [arrivalAirport]
)

The final output is shown below:  

v-yalanwu-msft_0-1622613893638.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

@v-yalanwu-msft thanks Yalan. That does work in the sample file and I appreciate the help so much.

However, when I try it in my actual file I'm unable to get the Calculate or AllExcept functions to work in the formula. I think it has to do with the fact I'm connected to a live PBI dataset my BI team has created (or the fact I'm on an Enterprise version of PBI maybe). 

Is there a workaround for live datasets? I tried to add the column to the Master Airports table, where it does work, but when I add it to the viz it breaks and a black box pops up and disappears very quickly with some kind of SQL error. I can't screenshot it - it's too fast.

 

Thoughts?

 

HotChilli
Super User
Super User

The first thing to do is to rewrite the column DAX so it's not using a measure i.e. [MaxArrival].  A calculated column should not use a measure (it's possible to do it but definitely not advisable)

 

Edit: I've just seen that [ArriveConnect] is a measure too so same advice applies.

Thanks @HotChilli. Do you know how I could re-write the DAX? I'm very new to all of this.

I'm not too sure how to re-write it becuase I need to be able to still reference something like MaxArrival and ArriveConnect to get my end result, don't I?

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.