  Let $\k$ be a field and let $A$ be a standard $\mathbb{N}$-graded
$\k$-algebra. Using numerical information of some invariants in the primary
decomposition of $0$ in $A$, namely the so called dimension filtration, we
associate a bivariate polynomial $\BW(A;t,w)$, that we call the
Bj\"{o}rner--Wachs polynomial, to $A$.
  It is shown that the Bj\"{o}rner--Wachs polynomial is an algebraic
counterpart of the combinatorially defined $h$-triangle of finite simplicial
complexes introduced by Bj\"{o}rner \& Wachs. We provide a characterisation of
sequentially Cohen--Macaulay algebras in terms of the effect of the reverse
lexicographic generic initial ideal on the Bj\"{o}rner--Wachs polynomial. More
precisely, we show that a graded algebra is sequentially Cohen--Macaulay if and
only if it has a stable Bj\"{o}rner--Wachs polynomial under passing to the
reverse lexicographic generic initial ideal. We conclude by discussing
connections with the Hilbert series of local cohomology modules.
