The rules are complex and depend a lot on origin, destination, transfers, operating airlines, class, sub-class/fare and more.
But here's a quick breakdown, with info from Emirates' checked baggage page, for the simple case (single flight, sold and operated by Emirates).
You can usually pool allowances of all passengers on a single ticket/booking, with the same itinerary and final destination. So if you have two people which both have 2 x 23 kg under the piece concept, you could have 3 bags for one person and a single one for the other.
You indicate that you have a 40 kg allowance, which points towards the weight concept. If it is the case, you can indeed go up to 40 kg total, but as pointed out above, not in a single piece of luggage: each must be 32 kg max.
You also indicate that your travel companion has a 2 x 23 kg allowance, which points towards the piece concept. That makes me think that the two people travel on different tickets/bookings, possibly with different itineraries. You probably won't be able to pool those.
Note that you an always have more luggage than the allowance: you'll just have to pay more for it ("excess baggage fees"). This can be very expensive.
On the other hand, you won't be able to check luggage that is heavier than the 32 kg limit per piece or larger than the 300 cm total length limit. Those need to be booked as freight, and the procedure is very different.
If you have connections, or one or more of the flights are operated by other carriers, then the rules can be different.