Calculating percentage from data type that includes option sets/texts/numbers/other data types

Hi everyone,

I am trying to calculate a percentage between different user’s matching_criteria data type, whose data fields comprises a mix of option sets/text/numbers and other data types.

I have worked out that these can’t be intersected as a list but that I have to intersect them all individually - please correct me if there is a better way…!

The two main problems are:

1 - Although I can calculate a count of UserA & UserB intersecting criteria with :count on each :intersect_with data type; when I try and divide by the UserB :count of their total criteria, the calculation is always wrong. eg. (x/z)*100

I cannot alter the parentheses to make the equation work, and I have been unable to find the plugins math.js or toolbox after installing them.

2 - I have 20 matching_criteria; that I need to intersect from the two users, and therefore 41 equations to perform for each vertical list item, so doing this on the view will make everything run super slowly.

Does anyone know how to send this specific user data to a backend workflow? I am currently sending data from a userB profile to a page that displays userA criteria in a vertical list. I can make that logic work, but I just don’t know how to get that to a backend instead.

Thank you so much in advance, I have spent about 40 hours trying workarounds and I just can’t work it out!

Parentheses sound like the answer here if you are think you are close with assembling the expression. It just takes some practice to put the number/parentheses where you want in the expression by clicking “More” in different locations.

Also if it helps, you can do parallel math and group expressions by nesting them in Arbitrary text:converted to number and doing math inside them

Thank you so much for your reply!

I have enabled the ‘show parentheses’ in settings, but when I hit “more” it still doesn’t give me the ( or ) option in the dropdown. I must be doing something wrong?

I haven’t tried arbitrary text yet, thank you for that too

I think I’ve just worked out that the ‘more’ ‘more’ options give you an indicator of where you’d like to place the ), thanks, but are you able to advise how to do one at the end? there are heaps at the beginning of the equation for all the match criteria, but after the / in the second part of the equation, I can’t add an additional ) to close off the equation before *100,

eg. the equation looks like (((ab+ab/c+d)+e)*100
I think that is where it’s all going wrong…

You might need to screenshot what you are talking about (with the expression focused so it shows all the More buttons). So I can see

But to add one at the end usually you just click the last “More” I think…

see what I mean about too many calcs :sweat_smile: very much need to move to a backend workflow! Thank you so much for helping with this….

1 Like

:rofl: OK I will let you deal with that…

This should probably stay frontend if you need the value to appear in the frontend. Only use backend if you are doing it in the background in some workflow.

Also another trick is to make groups with the datatype number then you can put different expressions as the source for each group then reference the group’s numbers as needed… it the same thing as doing parenthesis just split into groups for organization.

haha yes it’s a nightmare :sweat_smile: I really appreciate your help though! I’ll have a look into the group idea too, hopefully I can find a solution that way! Here is a screenshot of the results the calculation is bringing… I’m no mathematician but I’m pretty sure that’s wrong :rofl:

Yea you are running into some order of operations issues with such long expressions and parenthesis probably not in the right spots. Try the groups and see if you can get the outcome you are looking for at least. Then later it can always be put into one expression either by doing it carefully or “grouping” with Arbitrary Text

Thank you so much! I’ll give it a go and let you know