Dodgy ignition switch.
Poor/loose wiring harness multi-plug connection.
Fractured/intermittent main fuse or associated wiring.
Could be anything, really.
With these types of faults there`1s no point in just guessing, you need to arm yourself with a wiring diagram and systematically and methodically go through all the possibles.
.....or just take it back to the dealer, don`t waste your time on it if it`s under warranty..