mysql count problem

REFNUM----LOT_CODE----PCODE--wip_chemicalweighing--wip_compounding-------wip_extrusion--wip_forming--wip_deflashing
000001----000001P35M--P35M---0.00------------------0.00------------------0.00-----------0.00---------40.00---------
000002----000002P35M--P35M---73.30-----------------NULL------------------NULL-----------NULL---------NULL---------
and I have this code:

And the output of this code is :
PCODE-- lot_chemicalweighing---virtual----
P35M----1----------------------0--------
the lot_chemicalweighing is correct but the virtual is wrong, because it should be 2 because I have 1 data in wip_chemicalweighing and 1 in wip_deflashing.
Thank you