For several years, thanks to this forum, I succeeded for my thesis to achieve a bibliographic style adapted to my needs. However, I just realized now that it is well developed, a sorting issue.
I would like to be sorted by my label and not by name. I would like to have first the author alone, then two authors and finally "authors et al." in ascending order
I found some answers here: How to establish a complex sorting scheme of references in biblatex? However, this seems to create more problems than it solves.
Here is my problem in pictures which will be easier to understand
Here is what I have:
This is what i would like: 
Thanks, PS: sorry for my big MWE:
\documentclass{article}
\usepackage{csquotes}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage[%
backend=biber,
style=authoryear,
autolang=langname,
uniquename=false, %%enleve le système pour désambiguiser les auteurs
uniquelist=false, %enleve le système pour désambiguiser les auteurs
giveninits,
mergedate=false,
sorting=nyt,
maxcitenames=2,
maxbibnames=999,
mincrossrefs=1, %permet de citer l'entrée mère dès la première mention
]{biblatex}
\begin{filecontents}{\jobname.bib}
@InProceedings{agusta-boularot2017,
author = {Agusta-Boularot, Sandrine},
title = {Title},
booktitle = {booktitle},
year = {2017},
crossref = {agusta-boularot.etal2017},
}
@InProceedings{agusta-boularot2016,
author = {Sandrine Agusta-Boularot},
title = {Title},
year = {2016},
booktitle = {booktitle},
}
@Book{agusta-boularot.lafon2004,
title = {title},
year = {2004},
editor = {Sandrine Agusta-Boularot and Xavier Lafon},
}
@Book{agusta-boularot.martin2006,
title = {title},
year = {2006},
editor = {Sandrine Agusta-Boularot and Marin Martin},
}
@InProceedings{augustat-boularot.etal2019,
author = {Sandrine Agusta-Boularot and Chausserie-Laprée, Jean and N\'uria Nin},
title = {Title},
booktitle = {booktitle},
year = {2019},
timestamp = {2019-09-11},
}
@Article{agusta-boularot.etal2004,
author = {Agusta-Boularot, Sandrine and Christol Martin and Pierre Jack},
title = {Title},
journal = {Journal},
year = {2004},
volume = {17},
}
@Article{agusta-boularot.etal2010,
author = {Sandrine Agusta-Boularot and Raphaël Golosetti and Delphine Isoardi},
title = {Title},
journal = {Journal},
year = {2010},
pages = {109-126},
volume = {43},
}
@Book{agusta-boularot.etal2017,
editor = {Sandrine Agusta-Boularot and Sandrine Huber and William Van Andringa},
title = {Title},
year = {2017},
}
@InProceedings{paillet.treziny2004,
author = {Paillet, Jean-Louis and Henri Tr\'eziny},
title = {Title},
booktitle = {booktitle},
year = {2004},
editor = {Agusta-Boularot, Sandrine},
crossref = {agusta-boularot.etal2004},
timestamp = {2019-12-09},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
%%%style
\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}
\DeclareNameAlias{byeditor}{sortname}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\labelnamepunct}{\space\textendash\space} %tiret après le label
\renewbibmacro*{date+extrayear}{}% rajoute date
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,unpublished]
{title}{#1}
\renewbibmacro{in:}{% enlève guillemets articles
\ifentrytype{article}
{}
{\printtext{\bibstring{in}\intitlepunct}}}
\renewbibmacro*{issue+date}{%
\printfield{issue}%
\setunit{\addcomma\space}%
\printdate%
\newunit}
\DeclareFieldFormat{postnote}{#1} %enlève le p. automatique pour le postnote dans les citations
\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\setunit*{\addcomma\space}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
\newunit}
%permet de mettre des virgules à la place des deux points après l'adresse
\newbibmacro*{institution+location+date}{%
\printlist{location}%
{\setunit*{\addcomma\space}}
\printlist{institution}%
\newunit\addcomma
}
%Make all thesis/dissertation titles italic
\DeclareFieldFormat[thesis]{title}{\mkbibitalic{#1}}% %met les titres des theses en italique ; permet également d'enlever les guillements
%Enlever le tiret lorsqu'il y a une récurrence des auteurs
\makeatletter
\AtEveryBibitem{%
\global\undef\bbx@lasthash%
\clearfield{extraalpha}}
\makeatother
% "Et al." en ITALIQUE
\renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}
{\ifnumgreater{\value{liststop}}{1}
{\finalandcomma}
{}%
\andothersdelim\bibstring[\emph]{andothers}}
{}}
%%% Histoire des noms et al...
\makeatletter
\renewbibmacro*{begentry}{%
\renewcommand*{\mkbibnamefamily}[1]{##1}%
\defcounter{maxnames}{\blx@maxcitenames}%
\printtext[bold]{\usebibmacro{cite}\addspace:\space}%
\defcounter{maxnames}{\blx@maxbibnames}
\renewcommand*{\mkbibnamefamily}[1]{\textsc{\textnohyphenation{##1}}}}
\makeatother
%minuscule citation
\AtBeginDocument{\renewcommand*{\mkbibnamefamily}[1]{#1}}
%Enlève parenthèse colloque
\renewbibmacro*{event+venue+date}{
\iffieldundef{eventtitle}
{}
{%
\bibstring{presentedat}%
\printfield{eventtitle}%
}%
\ifboolexpr{
test {\iffieldundef{venue}}
and
test {\iffieldundef{eventyear}}
}
{}
{\setunit*{\addspace}%
\printtext{%
\printfield{venue}%
\setunit*{\addcomma\space}%
\printeventdate}}%
\newunit
}
\DefineBibliographyStrings{french}{%
byeditor = \iffieldequalstr{keywords}{source}%
{Établit\space par}%
{dir\adddotspace\smartof},
in = {\textit{in}},% %et en italique
editor = {dir\adddotspace},%
editors = {dir\adddotspace},%
opcit = \iffieldequalstr{entrytype}{article}{art\adddotspace cit\adddot}{\emph{op\adddotspace cit}\adddot},%
idem = {\emph{idem}},%
byeditor = {dir\adddot},% Remplace sous la direction de pour les improceedings etc.
ibidem = {\emph{ibid\adddot}},%
mathesis = {Mém. de master\addcomma}, %permet de modifier en français le titre et de rajouter un point un espace et une virigule
phdthesis = {Thèse de doct\adddot\space\addcomma} %permet de modifier en français le titre et de rajouter un point un espace et une virigule
%pagetotal = {p\adddot},%
%pages = {pp\adddot},%
}
%%modifie les pages des articles ... par pp. au lieu de p.
%\DeclareFieldFormat[article,inbook,inproceedings,incollection]{pages}{pp\adddotspace #1}%
%enlève la virugule avant dir.
\makeatletter
\renewbibmacro*{bbx:editor}[1]{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\usebibmacro{bbx:dashcheck}
{\bibnamedash}
{\printnames{editor}%
% \setunit{\addcomma\space}% DELETED
\setunit{\addspace}% ADDED
\usebibmacro{bbx:savehash}}%
% \usebibmacro{#1}% DELETED
\printtext{\usebibmacro{#1}}% ADDED
\clearname{editor}}
{\global\undef\bbx@lasthash}}
\makeatother
% put (dir.) at the end (byeditor) pour tout ce qui est in : auteur dir.
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{%%%\usebibmacro{byeditor+othersstrg} %%%% suppress
\setunit{\addcomma\addspace}%
\printnames[byeditor]{editor}%
\setunit{\addspace}%
% \addspace %%%% suppress
% \usebibmacro{byeditor+othersstrg} %%%%
\usebibmacro{editor+othersstrg} %%%%
\clearname{editor}% %%%%%%%%%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
%met entre parenthèse la collection et le numéro dans la même parenthèse
\renewbibmacro*{series+number}{%
\iffieldundef{series}
{}
{\printtext[parens]{%
\printtext{}%
\printfield{series}%
\setunit*{\space}%
\printfield{number}%
\printtext{}}%
}} %%% il y a un point en enleveant \nopunct.
%Rajoute une virgule après le titre du journal et avant le numéro du volume
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addcomma\space}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addspace}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
%Permet d'enlever le tiret après in si pas d'auteur.
\renewbibmacro{in:}{%
\ifentrytype{article}
{}
{\printtext{\bibstring{in}}%
\printunit{\intitlepunct}}}
%permet de mettre les initiales entre parenthèses et surtout les particules nobilaires
\renewcommand*{\revsdnamepunct}{\addspace}
\renewbibmacro*{name:family-given}[4]{%
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\ifdefvoid{#3}{}{%
\ifcapital
{\mkbibnameprefix{\MakeCapital{#3}}\isdot}
{\mkbibnameprefix{#3}\isdot}%
\ifprefchar{}{\bibnamedelimc}}%
\mkbibnamefamily{#1}\isdot
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}%
\ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibparens{\mkbibnamegiven{#2}}\isdot}}% added \mkbibparens
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\mkbibnamefamily{#1}\isdot
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}%
% \ifdefvoid{#2#3}{}{\revsdnamepunct}%
\ifdefvoid{#2}{}{\bibnamedelimd\bibopenparen\mkbibnamegiven{#2}\isdot}% added \bibopenparen
\ifdefvoid{#3}{}{\bibnamedelimd\ifdefvoid{#2}{\bibopenparen}{}\mkbibnameprefix{#3}\isdot}% added \ifdefvoid{#2}{\bibopenparen}{}
\ifboolexpe{%
test {\ifdefvoid{#2}}
and
test {\ifdefvoid{#3}}}
{}
{\bibcloseparen}}}% this line is new
%permet de mettre en minustile les styles de citation
\DefineBibliographyExtras{french}{\restorecommand\mkbibnamefamily}
%rajoute origdate
\renewbibmacro*{cite:labelyear+extrayear}{%
\iffieldundef{labelyear}
{}
{\printtext[bibhyperref]{%
\iffieldundef{origyear}{}{[\printfield{origyear}]\addspace}% <--- added
\printfield{labelyear}%
\printfield{extrayear}}}}
\renewbibmacro*{date+extrayear}{%
\iffieldundef{year}
{}
{\printtext[parens]{%
\iffieldundef{origyear}{}{\printfield{origyear}]\addspace}% <--- added
\printdateextra}}}
%%%%Permet de trier la biblio en suivant l'ordre du label et non pas des noms
%\DeclareSourcemap{
% \maps[datatype=bibtex]{
% \map[overwrite]{
% \step[fieldsource=author,match=\regexp{\s+and\s.+\s+and\s},final]
% \step[fieldset=sortname,origfieldval]
% \step[fieldsource=sortname,match=\regexp{\s+and\s.+},replace={\ and\ Zzz}]
% }
% }
%}
%
%\DeclareSortingScheme{emi}{
% \sort{
% \field{sortname}
% \field{author}
% }
% \sort{\field{year}}
% \sort{\citeorder}
%}
\begin{document}
\cite{agusta-boularot2017,agusta-boularot2016,agusta-boularot.lafon2004,augustat-boularot.etal2019,agusta-boularot.etal2004,agusta-boularot.etal2010,agusta-boularot.etal2017,paillet.treziny2004,agusta-boularot.martin2006}
\printbibliography[sorting=emi]
\end{document}
