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
Anonymous
Not applicable

How to use if else condition on different queries while creating custom column in Power Query

I have one query named Location with LocationId(unique), Location_desc

Another query Service Equipment with EquipmentID and locationID(multiple values).

 

I want to create a custom column in Service Equipment using the following condition

If  #Service Equipment"[locationID]= #"Location"[LocationID] then"Location"[Location_desc] else "Null"

 

Afther that I have appended multiple queries (euipment, Repar) with same column names and data types to get a single query.Which is why I have to create this column in the power query.

 

I am getting the following error Expression.Error: A cyclic reference was encountered during evaluation.

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

#Service Equipment" is the name of the query, so you're referencing the end result of the query from within the custom column, which is circular.

 

Forget the custom column and do a merge with Location and expand [Location_desc].

 

More resources on merging:
https://www.excelcampus.com/powerquery/power-query-merge-vlookup/

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

https://blog.enterprisedna.co/how-to-merge-queries-in-power-bi/

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks @AlexisOlson , It worked.

AlexisOlson
Super User
Super User

#Service Equipment" is the name of the query, so you're referencing the end result of the query from within the custom column, which is circular.

 

Forget the custom column and do a merge with Location and expand [Location_desc].

 

More resources on merging:
https://www.excelcampus.com/powerquery/power-query-merge-vlookup/

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

https://blog.enterprisedna.co/how-to-merge-queries-in-power-bi/

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.

Top Solution Authors