AZURE DATA FACTORY: THE EXPRESSION CONTAINS SELF REFERENCING VARIABLE. A VARIABLE CANNOT REFERENCE ITSELF IN THE EXPRESSION
Self refer a variable in a Set Variable Activity

In Azure Data Factory, you might encounter an error: “The expression contains a self-referencing variable. A variable cannot reference itself in the expression.” This error is due to a restriction in the Set Variable Activity to self-reference a variable.
As a workaround, you can create another variable that you will do your activity and then assign the result to your initial variable. Both your variables will have initially the same value.

Creating two variables “file_id_current” and “file_id_min”.
As an example, we have a variable “file_id_current” that will be incremented. We will use another variable called “file_id_min” that will have initially the same value as “file_id_current”. As the first step we will calculate the incremented value using the expression:
@string(add(int(variables(‘file_id_min’)), 1))