Skip to main content

Fixed: Sum Returns Blank Instead of 0 for an Empty Table in Power Apps

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

For a month with no entries, a Power Apps screen showed Total for September 2026: hours, with nothing where the number should be. Sum of a table with no rows returned blank, not 0, and Text turned the blank into empty text. Wrapping the Sum in Coalesce(…, 0) made it read 0.00 hours.

What I Was Doing​

I was building the My Overtime screen of the Overtime Timesheet app. It shows one month of a person's overtime, and a text control above the list gives the month's total. The screen keeps the month's entries in a context variable, locEntriesMO, and the total adds up their Hours, leaving out rejected entries (How to Add Up a Column in Power Apps with Sum):

lblTotalMO → Text (before)
$"Total for {Text(locMonthMO, "mmmm yyyy")}: {Text(Sum(Filter(locEntriesMO, Status.Value <> "Rejected"), Hours), "0.00")} hours"

In Preview, I opened the screen on November 2026 and selected the previous-month button twice, to September 2026: a month with no overtime entries.

What I Expected​

Total for September 2026: 0.00 hours, above the message that says there's no overtime that month.

What I Got​

The total had no number: Total for September 2026: hours. The message below it was right: You haven't logged any overtime in September 2026.

The My overtime screen in Preview for September 2026, with the heading Total for September 2026: hours with no number before hours, the note about weeks and rejected entries, and the message You haven't logged any overtime in September 2026

In October and November, the same formula showed 10.00 and 11.00 hours.

What I Checked​

What Sum gave on its own. After closing Preview, Studio still had September's values in its variables. I put the Sum part of the formula on its own in the control's Text and selected it, so Studio's preview strip, under the formula bar, showed its value (How to See What a Formula Returns in Power Apps Studio):

lblTotalMO → Text (for a moment)
Sum(Filter(locEntriesMO, Status.Value <> "Rejected"), Hours)

The strip read = Blank, with Data type: number, and the control on the canvas was empty:

The formula bar with the Sum of the Hours of the entries that aren't rejected selected, the preview strip reading = Blank with Data type number, and the My overtime screen on the canvas for September 2026 with an empty total control under the month

Microsoft's documentation.

  • The aggregate functions reference says Sum calculates the sum of its arguments, but not what it returns for a table with no rows.
  • The data types article says All data types can have a value of blank (no value), and Replace possible blank values with non-blank values by using the Coalesce function.
  • The Coalesce reference says it evaluates its arguments in order and returns the first value that isn't blank or an empty string.

Why It Happens​

In September, locEntriesMO held no rows, so Sum had nothing to add, and it returned blank rather than 0. Text then had no number to format, and the string had nothing between the colon and hours.

The Filter gives the same empty table in a month whose only entries are rejected, so that month's total would have been blank too.

The Fix​

Wrap the Sum in Coalesce, with 0 as the value to use when it's blank (How to Replace Blank Values in Power Apps with Coalesce):

lblTotalMO → Text (after)
$"Total for {Text(locMonthMO, "mmmm yyyy")}: {Text(Coalesce(Sum(Filter(locEntriesMO, Status.Value <> "Rejected"), Hours), 0), "0.00")} hours"

Coalesce returns the total when there is one, and 0 when there isn't, and Text formats either one with two decimal places. With September still loaded, the preview strip read Total for September 2026: 0.00 hours:

The expanded formula bar with the total's formula, Coalesce around the Sum with 0, selected, and the preview strip reading Total for September 2026: 0.00 hours with Data type text

Another way​

Hiding the total when there are no entries, with !IsEmpty(locEntriesMO) in its Visible, leaves the message on its own for an empty month. It doesn't help a month whose only entries are rejected: those rows are in the list, but the Sum still has nothing to add. Coalesce covers both.

After the Fix​

In Preview again, September showed Total for September 2026: 0.00 hours above the message:

The My overtime screen in Preview for September 2026, with Total for September 2026: 0.00 hours, the note about weeks and rejected entries, and the message You haven't logged any overtime in September 2026

November still showed Total for November 2026: 11.00 hours.

Common Mistakes​

MistakeWhat happensDo this instead
Text(Sum(...), "0.00") on its ownNothing where the total should be when there are no rows to addText(Coalesce(Sum(...), 0), "0.00")
Only looking at months that have entriesA blank total shows up first for the person whose month is emptyLook at a month with no rows too
Hiding the total for an empty listA month with only rejected entries still shows a blank totalCoalesce with 0

Troubleshooting​

SymptomLikely causeFix
A total reads : hours with no numberSum found no rows and returned blankWrap it in Coalesce(…, 0)
The preview strip shows = Blank for a SumThe table, after any Filter, has no rowsThe same
0.00 in a month that has entriesEvery entry that month is rejected, and the total leaves them outNothing to fix: the rows show their Rejected badges

FAQ​

Does Sum return blank or 0 when there's nothing to add?​

In this app it returned Blank, as the preview strip showed, and Microsoft's reference doesn't say which. Wrapping it in Coalesce gives the same result either way.

Is this a delegation problem?​

No. The rows were already in a context variable, the formula had no warning, and the table simply had no rows.

Conclusion​

Sum of a table with no rows returned blank, and Text of a blank is empty text, so the total read : hours. Coalesce(Sum(...), 0) gives 0 when there's nothing to add, and the total reads 0.00 hours.

Additional Resources​