It is definitely the total number of calories that matter in the end, but in my opinion, it's what makes you feel/function the best as far as macronutrients.
1500 calories of doughnuts probably isn't going to make you feel satisfied for the whole day, and after a few days of 1500 calories of doughnuts you're probably going to feel run-down and starved. Could you lose weight eating 1500 calories of doughnuts a day? Yes. But you probably will feel like crap if you do it that way
That's where the macronutrients come in: where do you put them so that you feel satisfied all day long and have energy?
For me, I'm on a very low carb diet (a ketogenic diet) and my macros are more like 6% carbs / 44% protein/ 50% fat on a daily basis. Those ratios keep me feeling full all day on 1500 calories/day. Other people have a lot of success with other ratios...it really depends on how your body handles different foods.
But in the end, whether I'm eating 6% carb/44% protein/50% fat ratio on 1500 calories a day or 60% carb/ 25% protein/15% fat ratio on 1500 calories a day, I'm still in the same caloric deficit and I'll drop the same amount of weight per week (technically). But for me, if I ate 60% carbs a day I'd be miserable and STARVING on 1500 a day, whereas I'm completely satisfied on 6% (all coming from vegetables) with the rest being protein and fat for that many calories.
I don't mean to be confusing...I hope it helps? The macronutrient breakdown is really individual, it's the calorie deficit that ultimately matters.