Not so much a question as an observation. I have a canvas app, using a dataverse table holding expense lines.
I wanted to display a label above a gallery that contained a summary of the gallery data but
without applying the search criteria used to filter the gallery itself (the totals would always be correct regardless of what was being searched for).
It's something I have done many times before but never had this problem with:
Staring code
Match(
Concat(GroupBy(Filter(Expenses, EXStatus=DDExpenseStatus.Selected.Value),
extechname, GRPData),
extechname & ": " & If(1>2, First(GRPData).EXTotalPaid & " ") & Text(Sum(GRPData, EXTotalPaid), "#,###,##0.00") & ", ")
, "^(?<trim>.*), $" ).trim
The text displayed the correct strings from extechname column, separated by commas but no values at all. Showing the command in the formula bar it resolved correctly with the values summed as expected
Changed to this to check that the data was present
Match(
Concat(GroupBy(Filter(Expenses, EXStatus=DDExpenseStatus.Selected.Value),
extechname, GRPData),
extechname & ": " & First(GRPData).EXTotalPaid & ", ")
, "^(?<trim>.*), $" ).trim
The text displayed the correct strings from extechname column with the EXPTotalPaid value from the first row in GRPData, separated by commas.
Solution
Match(
Concat(GroupBy(Filter(Expenses, EXStatus=DDExpenseStatus.Selected.Value),
extechname, GRPData),
extechname & ": " & If(1>2, First(GRPData).EXTotalPaid & " ") & Text(Sum(GRPData, EXTotalPaid), "#,###,##0.00") & ", ")
, "^(?<trim>.*), $" ).trim
This now displays the sum correctly, simply by referring to the EXPTotalPaid in a way that it will never be displayed . . . If(1>2, etc.
Seems a bit weird to me but I can only imagine that the column is not being displayed if it is not explicitly referenced and because the groupby only exists within the label a reference to it anywhere else does not count.
Anyway, I thought it might be useful to anyone else experiencing a similar problem.
I will leave the post open for now, in case anyone has a better solution.