How to use the value of a Dictionary in a calculation? I get a "failed to evaluate" error

Displaying %Dictionary[Dic,Milleage]%, shows 800.

But the "800" can't be used in calculations....

Set variable TheSum
to TheSum + %Dictionary[Dic,Milleage]% , should increase the variable TheSum by 800, but I get an error

Screen Shot 2021-11-22 06 23 48 PM

Thank you

Hi Leonardo,
The error message you’re showing in the screenshot does not refer to %Dictionary[Dic,Milleage]% so I’m not sure what to suggest.

It would save a lot of guesswork if you would post the actual macro here so we can get a better idea of what’s going on.

Here it is. Disable the last action and it shows 800, but if you enable it throws the error.

Found the solution. Have to wrap it in the CALCULATE() function.

TheSum + CALCULATE(%Dictionary[Dic,Miles]%)

Ooh - well done!

I was going to suggest you try 2 things:

  1. Just drop the % signs around your dictionary element.
  2. If that didn’t work, try the approach that you’ve already tried.
1 Like