Sounds like a BIOS issue.
Did you already replace the CMOS battery on your motherboard?
Try different graphics settings described at pages 29ff in your motherboard's manual
Thank you Stefan.
Yes, I checked the CMOS battery with a voltmeter and it is fine.
My motherboard is not the Pro Gaming, but the Z 170 Pro (without the Gaming). It has less options in the bios (basically, using it concurrently with a discrete card or not, and if yes, select which card is the main one). I tried all the options but without success.
I would be tempted to re-flash the bios but I must admit I am a bid worried I could make the things worst ("brick" the whole computer).
Anyway, thank you for your help