Multiple groups legend dynamic

I’m trying to have multiple groupby in the same trace but the legend is not display propbly how can i control the legend when i have muiltple groupby.
thx in advance!