hello ewtay,
the code failed because you enclosed the else value in double quotes.
please follow these instructions & try again.
1 copy the code.
2 open report for edit.
3 if necessary hit F4 to show preference pane.
4 drag out a text box in the detail pane.
5 hit the data tab in preference pane.
6 'Data Field Type' = 'Field or Formula'.
7 'Data field' = paste the code here & hit enter.
8 execute report & hey presto no more 'NaN' regardless of data source (query or table).
Villeroy has given you an alternative solution in the form of a query which again is guaranteed to work.
Looking at your print out it would appear that your label & data fields are both in the Detail Pane.
i suggest you create a header by:-
1 press (ctrl + G) to bring up the sorting & grouping window.
2 click on the list box arrow under 'Field/Expression'.
3 click on the list box to the left of the arrow.
4 drag your labels from the detail pane into the header you have just created.
open office 4.1.14 & LibreOffice 6.4.4.2 x64 using HSQL 1.8.0.10 (Embedded) and HSQL 2.6.0 (Split) on Windows 10