Skip to main content
Question

Best practice to sum 2 metrics having different dimensions

  • March 1, 2026
  • 2 replies
  • 22 views

  • Apprentice Author

Following reading this page about how Pigment handles blank cells with metrics with different dimensions (How Pigment Handles Blank Cells), I have the following questions :

What is the best practice to maintain both source metrics values (e.g. treating blanks as zeros from the metric with the most dimensions) ?

  • e.g. if I want metric C to hold for Spain Metric A + Metric B = 5 instead of blank for Product A (in the case of different costs sources with different dimensions structures, total cost should always be A+B, not A+ depending whether A is not empty, add B) ?
  • I make do with a simple Metric A + Metric B[Add : Country]
  • Yet I wonder whether this would be the best option in term of keeping balance between performance + sparsity ?

Another question : are there plans to modify this default behaviour in the future ?

  • I ask this because it is kind of counter intuitive to account for metric dimensionality discrepancies when dealing with mathematical operations like + and -
  • I creates an additional intellectual workload for simple operations like + or - (accounting for a non neutral number which is blank)
  • I requires the need to take into account source metrics dimensionalities when dealing with + or - when creating formulas or changing block structures, while * or / operations dont require this kind of attention (‘blank’ * ‘any numer’ will always result in ‘blank’ whatever their respective dimensions structures)
  • Excel handles blank as 0 when it comes to + or -, so people coming from Excel (as lot of people do) would expect this

2 replies

Nathan
Employee
Forum|alt.badge.img+12
  • Employee
  • March 2, 2026

Hi,

that’s a deep question for a first :)

 

I’ll give you the explanation the same way we teach Pigment for app builders: ALWAYS align dimensions within your formulas. Use modifiers for it: BY, ADD, REMOVE 

I don’t know if I’m biased by Pigment but to me, in this example, A+B is just wrong, it doesn’t make sense

I wouldn’t expect 5 for Spain for Product 1, but blank, 5 is wrong. Just like you would get blank if you were doing a multiplication.

 

 


  • Author
  • Apprentice Author
  • March 4, 2026

Thanks, so force Add to align the dimensions and make the addition work

To explain in terms of layman terms : 

  • nothing x 5 times gets you always nothing.
  • nothing + 5 things gets you always 5 in the end (because nothing isnt a black hole or an antimatter well).

That’s because 0 is a neutral element in math for addition, but not for multiplications (then neutral element for multiplication is 1).