The error message "A circular dependency was detected" in Power BI often happens when there is a calculated column or measure that is trying to evaluate itself back either directly or through other measures or columns based on them. This creates a cycle that remains unresolved by Power BI. Solving this problem demands that you examine the DAX formulas you have written and check that they do not refer back to one another.
First and foremost, look at all the measures and calculated columns contributing to the error and their relationships. In Power BI, you can check the dependency view and see how the calculations depend on each other. This shows the measures and columns and the degree of their interrelation, thus helping to detect any circular references, if any. In addition, such complex calculations can be easily divided into simpler ones and built in the order of hierarchy. Rather, intermediate measures should be created that will allow the reference but will not lead to circular referencing so as to facilitate the debugging process and, in most cases, provide better performance as well.
When you need a certain value to refer to another calculation that causes a circular dependency, try to change the way the formula works so that it does not depend on that. For instance, in the case of two measures depending on each other, check if it is possible to do so with one measure incorporating a part of the calculation in its variable (VAR) instead of handling it with another measure or column. In this way of breaking dependencies and using variables effectively, those circular dependencies without adjusting the logic of DAX calculations can often be taken care of.