I had exactly this same issue with my 2014 D40 from brand new.
I am a mechanic and I did all the same checks that 'bods' has suggested before taking it back to the dealer.
The first time I took it back to the dealer they told me there was no problem with it as they could not fault the problem. I was told if there is no fault code then there is no problem. With my D40 also, 90% of the time it was a cold start issue, however occasionally it would start and stall after sitting for an hour or so.
The second time I returned the car the dealer at 1200 kms they replaced the fuel filter and the check valve on top of the filter and I would think or at least hope also checked for loose clamps or hoses that could cause air leaks, the clamp check I had already done.
The the issue still persisted and I returned the vehicle twice more with the same issue and the dealer had no reasonable explanation for the issue and same excuse of no code, no problem.
When I returned the vehicle for the fifth time I made some noise and told them to keep it until the problem was sorted. After a week I got a phone call to say it was all sorted.
The dealers explanation for the fix was a complete reload of the ECM program. Since that was supposedly done there has been no issue for the past 4 years. It also could be something that the dealer decided not to tell me about as well and just used that to explain something they had missed.
If this did fixed the problem is debatable how. If the computer (ECM) does not see exactly the correct information at the right time then it just shuts down and the engine stalls. This could be something to do with a number of sensor inputs like fuel pressure, oil pressure etc. It also could be a sensor that is working but out of the operating range the ECM likes to see.
The fuel system should have a check valve that stops fuel drain back to the tank. As 'bods' suggested before you try to start on your next cold start, use the primer pump to pressurize the filter and see what happens there. It that fixes the issue then it is most likely a fuel drain back issue. If you are having to continually crank to get it started that sounds like fuel pressure or air in the fuel system.
Also cranking voltage can be an issue. If your battery is old, even though it may sound like its OK, if the battery voltage drops below what the ECM likes to see then this can cause a shut down. This also can be a starter issue if it is pulling to much current when cranking.
Have you connected a code reader to see if there are any fault codes or stored codes ? There are a number of scan gauge type reader tools on the market for around $80, that way you can see, read and delete codes as well as see most of the sensors working in real time.
Keep us posted with what you find
Cheers
Pete