Firstly, for tournaments you will need to add "tourney_" to the start of the database table name.
To include kraada's additional check you need to add that inside the expression, not after it:
sum(if[
tourney_holdem_hand_player_statistics.enum_allin = 'P'
AND lookup_actions_p.action != '', 1, 0])
See the
Tutorial: Custom Reports and Statistics for more information on how to construct column expressions.