Given you're using an XQuery 3.0 capable query processor, use the group by
clause.
for $b in $xml/DashboardXML
let $count := count($b/Column)
where $count > 0
order by $count descending
group by $count
return <li>{$b/DashboardName/text()} = {$count} ({count ($b) }) </li>
Which will output
<li> = 1 (1) </li>
<li> = 2 (2) </li>
for the input given (notice the missing DashboardName
elements and that I changed the where
clause to allow any non-zero number of Column
children).