I'm trying to work out a way of using the Code Editor (or any other calculated field method) to generate a fixed Level of Detail (LOD) value for an imported dataset. Specifically, I'd like to create a field with the total activity/case duration for all records - i.e. not at the individual case level. 

So, for example, the fixed LOD value for the dataset below would be 7 days:

Case ID Activity Timestamp Activity duration Case duration
1 A 01/11/2022   3
1 B 02/11/2022 1 3
1 C 04/11/2022 2 3
2 A 01/11/2022   4
2 B 04/11/2022 3 4
2 C 05/11/2022 1 4

Not sure how to accomplish this? I think that the PU_SUM function might possibly be the way ahead, but a) I can't seem to find an example of how to populate the syntax requirements correctly (i.e. PU_SUM(scope: Table, source: Table, field: Field | Calculation, filter?: Boolean)) and b) I suspect that this would only roll up to the case level, which is already available from the standard Case Duration measure. 

One of the reasons that I would like the ability to create fixed Level of Detail calculations of this ilk is to be able to generate an Index to compare distribution and performance metrics - for example, in the App Builder, I can configure the Number of Occurrences and Activity Cycle Time measures to display as a percentage share within the App, but I can't seem to build calculated fields for the same percentage share values to then compare and Index the distribution metric (i.e. Percentage Share of Count of Number of Occurences (Base (100%) value = (CT (Number of Occurrences)) with the performance metric (i.e. (i.e. Percentage Share of Sum of Activity Duration (Base (100%) value = (SUM (Activity Duration)). I haven't worked out a way to achieve this.