I am trying to calculate the percent difference between two numbers whether it is greater than the original number or less than the original number. My Original Number is "A1" and by new number is "A2". The formula I am using is :
event.value = Math.abs(Number(this.getField("A1").valueAsString) / Number(this.getField("A2").valueAsString));
This works correctly if A2 is greater than A1 but if it is less than A2 it does not
1. A1= 16,000 A2=17,456 Outcome is 91.66%
2. A1= 16,000 A2=14,500 Outcome is 110.34% (Should be 90.625%)
Any help with be greatly appreciated, thank you.
Views
Replies
Total Likes
Hi,
Have you tried just adding an IF statement using Greater Than logic to change the order of the division?
I just did a simple example using static values, but:
And to do this, I used:
Basically, I check if A1 is greater than A2, if it is, then I divide A1/A2, otherwise I divide A2/A1
You can replicate this logic using your actual metrics that will change values rather than my sample using static values.
Views
Replies
Total Likes
I really apricate your response. I don't know how to do what your asking.
I am very new to calculations in adobe so if there is something very basic I can
follow I can apply it and hopefully learn from it.
Views
Replies
Total Likes
So what I showed above was the Adobe Workspace and the Calculated Metric Builder.
So I am assuming you have a table with two columns, one for A1 and one for A2?
You can select the two metric headers, right click, and choose "Create Metric from Selected > Divide" as a good starting point.
This will create a simple A1/A2 column:
But you can edit this, by hovering over the new metric, clicking on the (i) icon, then clicking on the pencil (if you don't see the pencil then your admin hasn't given you the rights to create calculated metrics, but if you have already been trying things, then you should have that)
You can use the "Add" button in the definition area to add functions:
You will need to add an "IF" function, and inside the logical test, you will need to add a "Greater Than" or "Greater Than and Equal To" function... then just move around / add your metrics inside the formulas as in my screenshot, but using the actual metrics instead of my static content placeholders....
Views
Replies
Total Likes
I have it in an adobe PDF file.
The formula is in the Properties section.
Views
Replies
Total Likes
Views
Likes
Replies