Not very elegant, but it worked. I think there are ways to simplify this. Also it could be an alternative to change the datamodel into an (additionally) table like this:
Product MeasureReference MeasureScenario1
test_highlighting.qvw 214.2 K
Use the Total <field> within the function to total by the product, then you can change the formula to do a number of things that suit your individual requirements eg count distinct scenario, or sum all the measures.
sum(total <Product> Measure)/ sum(Measure) <>2)
*(Scenario = 'Scenario 1')*green(100)
as the Highlighting condition.
This checks that the total measure is equal between the two scenarios, and that the scenario the line is on is "scenario1".
Let me know if this works
Thanks Marcus for your answer.
Indeed, it's not perfect, specialy because everytime a new product will be added, the formula will have to be updated.
Also, I tryed to play with above() and rowNo() function, but I think above() doesn't accept dynamic offset.
If I can't find a better solution, I will follow your advice and change the datamodel.