You need to use peek first to get value into variables. Then compare variable in if
Count(DISTINCT Sector) as fc
Let vFactCount = Peek('fc',0,TableB);
Please do the same for both your variables and then compare. AS of now both having NULL I guess as per your current script.
I think you could use the following:
Let vFactCount = fieldvaluecount('Sector');
Let vMappingCount = fieldvaluecount('SectorMap');
If '$(vFactCount )' <> '$(vMappingCount )' then
Trace 'ERROR: Count Mismatch: Fact Count - ' & '$(vFactCount )' & 'and Mapping Count - ' & '$(vMappingCount )' ;
Trace "Validation Check Complete";
whereby you will need to load the mapping-data twice - one time normal to be able to access the table/fields and then a second time as mapping-table which is in general unaccessable unless by using mapping functions/statements.