Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I'm trying to format a pivot table based on previous/above rows.
Let says I have this table :
Scenario | Product | Measure |
---|---|---|
Reference | A | 12 |
Reference | B | 20 |
Reference | C | 15 |
Scenario 1 | A | 10 |
Scenario 1 | B | 21 |
Scenario 1 | C | 15 |
I would like to compare the measure value of products in both scenario.
In the above example, only product A and B should be highlighted because their value changed between both scenario.
I tryed something like this but it doesn't work :
if(Scenario<> 'Reference',
if(SUM( {1 <Scenario={'Reference'}>} Measure) <> SUM( {1 <Scenario={'Scenario 1'}>} Measure), green(100))
)
Any idea ?
Regards
Hi Marcus
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.
EG Try
=(
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
Erica
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:
table:
Product MeasureReference MeasureScenario1
- Marcus
Hi Marcus
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.
EG Try
=(
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
Erica
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.
- Jean
Hi Erica,
Indeed, your solution is clever and works very well !
Thank you very much !
No problem!