Hello everyone, I'm trying to add a column that will sum up values in another column based on a few conditions. The code I currently have uses List.Sum. I have to do a similar conditional running total calculation several times in my query along with a few other transformations. The query currently takes about 7.5 minutes to evaluate and I suspect that this code is the culprit. Is there a better way I could handle the code below?
I am aware that there are ways to use a custom function based on List.Generate but I'm not sure how to customize the custom function to exclude values that don't meet desired conditions.
Thank you again in advance for your help.
I am aware that there are ways to use a custom function based on List.Generate but I'm not sure how to customize the custom function to exclude values that don't meet desired conditions.
Power Query:
ConditionalRT = Table.AddColumn(Source, "Conditional RT", (x)=> List.Sum(Table.SelectRows(Source, each _[Condition1] = x[Condition1] and _[Condition2] < x[Condition2] and _[Condition3] = "Condition3")[Values]), type number),
Thank you again in advance for your help.