Calculated score for company/user

Hi,
In reference to a case already opened - Calculated score - I need to create a score for each company rather than for each user, but it should still be based on the actions of the users.

In essence, each user can perform the following actions:

Convert = value 4

Navigate a URL = value 3

Click on an email = value 2

Open an email = value 1

Based on this, we could have a score like this:
score = ({open mail} * 1 + {click mail} * 2 + {page view} * 3 + {submission} * 4) / {total interactions}

But in the starting table, I also have the detail of the date when the action was taken.

Therefore, I would like to add these variables to my score:

  1. If a user performs more than 1 action on the same day, then they will have a higher value compared to one who performs actions over different weeks.

  2. If a user is from a company that already has many other users who have interacted, then their value will be higher. Essentially, the conversion of a user from a company with another 10 people who have read a communication is worth more than 1 conversion of a user who remains the only one from their company to have done something.

This is the structure of the initial table.

date user company open email click email submission page views total interactions score
02-mag abc@gmail.com a 1 2 3 ??
14-mag def@gmail.com b 1 1 1 3 ??
14-mag aht@hotmail.it c 5 5 ??
14-mag ars@gmail.com a 2 5 7 ??
1 Like

Hello @andreab, it looks like you are going to need to utilize LAC-W in order to receive scores per user and sum them across the entire company. This will get more complicated if you want to start accounting for interactions in a day, but should still be feasible.

User Score per Day= (sumOver({open mail}, [{user}, {date}], PRE_AGG) + sumOver({click mail}, [{user}, {date}], PRE_AGG) * 2 + sumOver({page view}, [{user}, {date}], PRE_AGG) * 3 + sumOver({submission}, [{user}, {date}], PRE_AGG) * 4)/sumOver({total interactions}, [{user}, {date}], PRE_AGG)

You can use that field to determine a daily score per user. Then if you wanted that to all build into a score for the company, you can nest the numerator and denominator of the function above and partition in by company. You could do this to build an overall score or a daily score depending on your partition field.

Company Overall Score = sumOver((sumOver({open mail}, [{user}, {date}], PRE_AGG) + sumOver({click mail}, [{user}, {date}], PRE_AGG) * 2 + sumOver({page view}, [{user}, {date}], PRE_AGG) * 3 + sumOver({submission}, [{user}, {date}], PRE_AGG) * 4), [{company}], PRE_AGG)/sumOver(sumOver({total interactions}, [{user}, {date}], PRE_AGG), [{company}], PRE_AGG)

Company Daily Score = sumOver((sumOver({open mail}, [{user}, {date}], PRE_AGG) + sumOver({click mail}, [{user}, {date}], PRE_AGG) * 2 + sumOver({page view}, [{user}, {date}], PRE_AGG) * 3 + sumOver({submission}, [{user}, {date}], PRE_AGG) * 4), [{company}, {date}], PRE_AGG)/sumOver(sumOver({total interactions}, [{user}, {date}], PRE_AGG), [{company}, {date}], PRE_AGG)

Lastly, to get the number of users per company that read a communication, you can do this. I am assuming read a communication is related to opening an email:
Users with Daily Interactions = ifelse(sumOver({open email}, [{user}, {date}], PRE_AGG) >= 1, {user}, NULL)

More than 10 Active Users = ifelse(distinctCountOver({Users with Daily Interactions}, [{company}, {date}], PRE_AGG) > 10, {company}, NULL)

That can be used to add that portion to your score. I will mark my response as the solution, but I know there are a lot of calculations needed here, so please let me know if you have further questions.

1 Like