I'm not sure if you are trying to predict end of life, but this is impossibly difficult.
When my mum went into her care home she had lost significant weight and was a size 12 to 14 clothes wise. 9 months later she was a size 6 based on the clothes I was asked to provide. 5 months after this I was told she had continued to lose weight and they considered her likely end of life, best estimate 2 weeks, but could be 24 hours or could be 2 years, she lasted 3 weeks.
The end of life was partly based on the fact she was no longer drinking much fluid, even with encouragement as well as eating less and less.
My mum was still mobile, able to make jokes, and eating and drinking small amounts up to and including the day she died.
Other posters on here have had for example relatives go 17 days without food and drink at actual end of life, and also several examples over the years of bed bound barely mobile unresponsive family members lasting years on a couple of teaspoons of yoghurt a day, which was very distressing for the relatives involved.
Throughout her time in the care home mum was offered as much food as she would eat, and fortisip type drinks were always provided. Whilst able to mum went to the dining room for meals 3 times a day, food was presented to her in different ways to encourage eating and was offered cake on top of this, but was still loosing weight.
I am not aware if she was weighed as I could see she was thinner, and felt no need to distress her, when the slow weight loss is an unavoidable part of dementia and dying.
My understanding is that the body no longer processes food in the same way in the later stages so measuring calories doesn't really make sense as the body might not be absorbing them.
Unfortunately there is no text book answer as each PWD will present differently.