This is how I solved your first question (desired result).
Define # sites as follows: iif([Sales]>0,[Store Code (Sites)],null)
Then define a table calculation "Distinct Sites" as COUNTD([# of sites]). Drag it to Text.
Attaching the resulting workbook - hope this helps.
Site example.twbx 22.5 KB
Thanks a lot Stoyko. Much appreciated