I found in the reference manual that it is possible to show the number of pieces of a stack in the Mouse-over Stack Viewer.
Can I use the total Unit Count of all pieces in the stack anywhere else except the Mouse-over Stack Viewer? I’d like to set this number as a Global Property Value.
If I understood your question, yes you can. The same principle is used for card counting a deck which you can then for example display on a board by creating an at start stack, with a single piece in it containing text labels with the property value as their text (for example in your case “Units in stack: $UnitCount$”)
I think you are wrong. You talk about counting expressions that may calculate items that are inside (and only inside) a deck. That won’t work outside a deck.
I think you can do this, actually, though I haven’t tried it. Follow the example for counting pieces on a map, but add Matching Properties for CurrentX and CurrentY. So you either have specific coordinates that you want to monitor (like an at-start stack), or you have a specific piece that you want to monitor, that sets the relevant X and Y when it ends movement on a map.