The easiest way to get this is to start with the fill level at maximum. This will put 15 lines on grid that only have one block missing to finish the line. So work your way down and try to clear these 15 lines and then just play as you normally would to clear the rest of the 40.