I have a table of months.
I have a table of internship duties, each one chooses which month they will be completed in (some are just one month, some will be done over the course of many months). So options for an internship duty might look like the following:
[duty column] Answer emails [month column (lookup from table)] March, April, May [# of hours] 5
[duty column] Event 1 [month column (lookup from table)] March [# of hours] 10
What I want to do is in a separate table (separated by role), summarize ALL of Marchâs hours. So in this example the table would pull
March: Answer emails - 5 hours, and Event 1 10 hours = 15 total hours in March.
What itâs doing is returning each COMBINATION of months as rows in the table. So it would so show
March
March, April, May
As my options instead of counting âanswer emailsâ in each of march, April, and Mayâs rows.
have a look at this and tell me if this is the desired outcome:
Yes, you are right: the group by considers the unicity if the column, so you canât actually have it in the same table
The formula for Total Hours is pretty straightforward:
Duties.Filter(thisRow.In(Month)).[Month Hours].Sum()
// [From the end]:
// Please, give me the sum of all the hours of Duties table where the month of thisRow appears among the months
the In() function we not often come accros.
just check if the month is âInâ the list of months and if so, take the sum.
why donât we see this function more often used @Federico_Stefanato ?
(*)
âSomehowâ, because In() accepts a single value search while Contains() searches for sublist within a list, therefore the former should be more performant (it really depends on the underlying implementation: donât take this as a statement).
This is very helpful, thank you @frederico_stefananto - but I think I figured out what would be MORE helpful if itâs possible. Is there a way to âgroupâ by month in this case? Where the same row would show up in multiple groups because it includes multiple groups as options?
it seems to imply that once you have a list filled with single items (seperated by a comma) the In() is maybe the way to go, while having a sublist [[sublist1],[sublist2],[sublist3]]Contains() looks like the right candidate.
I would love to understand better when to apply a function.
(*)
âSomehowâ, because In() accepts a single value search while Contains() searches for sublist within a list, therefore the former should be more performant (it really depends on the underlying implementation: donât take this as a statement).
As said, you cannot group by the table itself, however you can take advantage of the reference Months table to aggregate the duties by month (via a bi-directional lookup).
Have a look at the modified example in the same doc and tell me if this work for you.
Basically, you just edit the Duties table and Months is directly affected.
Tell me is this is going to the right direction.
Cheers!