Thank you for your answer. Here is a little bit more info about the formula.
A1 is represents revenue (TR) and B2 is represents the costs (MC). The formula in Excel returns an amount between -1 and 1 (that is why we have MAX and MIN). The YTD Flags are fixing the amounts in the current year, both A1 and B2 in Qlik Sense are returning correct results, the error appears when I try to include the Min and Max functions.
I don’t have a qvs file, but for example, if A1 is 150 and B2 is 40, the formula will bring 1.
If A1 is 60 and B2 is 80, the formula will bring 0.25.