If you only need the eventcount, then this should do the trick:
index=foo sourcetype=A OR sourcetype=B Device_MAC_Address=* |
eval isFromA=if(sourcetype=="A",1,0) |
eval isFromB=if(sourcetype=="B",1,0) |
stats sum(isFromA) as A sum(isFromB) as eventcount by Device_MAC_Address |
search A>0 eventcount>0 | fields - A
You may wanna watch this presentation, it gives you a good start in questions like this: http://conf.splunk.com/sessions/2016-sessions.html#search=Let%20Stats%20Sort%20Them%20Out&
Hth,
-Kai.
... View more