My Sony Xperia Z1 compact has started loosing charge quickly and when it gets to about 40% it then goes to nothing and turns off very fast. Does anyone know why? It's only started doing this in the past week.
How old is the phone? If it's more than 18 months, I would suspect that the battery might well be on its way out. Would be worth taking the battery out (if you can) and put it flat on a table and see if it wobbles. If it does, then the battery is certainly failing and should be replaced. If your phone is still within its warranty period, try and see if the reseller/mfr will repair it under warranty, but I wouldn't be surprised if they don't - not many manufacturers warranty the battery as long as the phone.
Alternatively, a quick Google suggests that this fault has been seen (within the last year) as a software fault, and can be fixed by downloading Sony's PC Companion software and working through the guide here.
Just another VM user trying to help, so no guarantees that my advice will work . If my suggestion is helpful, please mark it as helpful; it may help others. Just want to say "Thanks"? That's the Kudos button.