Welcome to Just answer
How old is it ?
and when it works do you also hear any unusual sound from the washer ?
any flashing lights on the front ?
OK, can you please pull the washer out and then try to clean it completely
after cleaning take the top off the unit and locate the pressure switch
there is a thin hose attached to it
try to clean that thin hose completely
and with a screw driver give few taps on the pressure switch
after everything is cleaned including the pressure switch the problem should be solved
let me know how it goes