Aggregating sum of priorities from a bootstrapped excel list


Let's assume you have entity A with an x number of clients and an entity B with their orders and the priority of their orders (both entities were bootstrapped from excel). I want to be able to display the aggregate sum of priority 1 for client 1 in a list, i.e. if client 1 has 5 orders 2 of which are priority 1, I want to be able to display an icon with text "1" and a badge that contains the amount of orders with priority 1.

I have tried to do that already but I failed and don't know where I went wrong. My procedure was as follows: I made an aggregate with entity B that filters the list based on if the orders of entity B were equal to the current orders of entity A. I then added 3 different attributes to entity B for the 3 different priorities that display 1 if the priority matches and 0 if it doesn't and I summed each with their corresponding aggregate function. This though would only calculate the values for the first value for entity B as the current only pointed to it. So I made an action that ran in the beginning of running the application that would run through every entity A and in each run it would aggregate B and assign the summed values to the corresponding Prio1, Prio2, Prio3 attributes in entity A. 

I don't exactly understand what I messed up here, thanks in advance for the help, and I would be glad to clarify further! 

Rank: #68


Can you try doing it with a simple aggregate?

You have all the group functions of SQL if you right-click a column name. You can do Group By, COUNT and SUM. I think that will do the trick.