the LBF is not the problem here. but to control the LBH the way you want, you need to know the total before printing the LBH. To avoid having to process the data twice, create a conditional section to act as your LBH section, and only print it (by calling the conditional section from your LBF section) if the total is not zero.
however, if you need to print the main section as well, then i don't think you can avoid "double processing".