Well, I do not know if this is quite OK, but is returning the expected results … so at the moment this it is enough for me.
function my_custom_get_terms( $my_tax, $my_category, $show_all = true ){
global $wpdb;
global $pagename;
$query = "SELECT Count(wp_posts.ID) AS my_term_count, wp_term_taxonomy.term_taxonomy_id, wp_term_taxonomy.taxonomy, wp_terms.name, wp_terms.term_id, wp_terms.slug AS term_slug, wp_terms.term_group, wp_terms_1.slug
FROM (((((wp_term_relationships INNER JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) INNER JOIN wp_terms ON wp_term_taxonomy.term_id = wp_terms.term_id) INNER JOIN wp_posts ON wp_term_relationships.object_id = wp_posts.ID) INNER JOIN wp_term_relationships AS wp_term_relationships_1 ON wp_posts.ID = wp_term_relationships_1.object_id) INNER JOIN wp_term_taxonomy AS wp_term_taxonomy_1 ON wp_term_relationships_1.term_taxonomy_id = wp_term_taxonomy_1.term_taxonomy_id) INNER JOIN wp_terms AS wp_terms_1 ON wp_term_taxonomy_1.term_id = wp_terms_1.term_id
GROUP BY wp_term_taxonomy.term_taxonomy_id, wp_term_taxonomy.taxonomy, wp_terms.name, wp_terms.term_id, wp_terms.slug, wp_terms.term_group, wp_terms_1.slug
HAVING (((wp_term_taxonomy.taxonomy)='$my_tax') AND ((wp_terms_1.slug) = '$my_category'))
ORDER BY Count(wp_posts.ID) DESC";
$datos = $wpdb->get_results($query, OBJECT);
echo "<ul>";
$total = 0;
foreach ( $datos as $dato ) {
echo '<li><a href="' . get_bloginfo('url') . "https://wordpress.stackexchange.com/" . get_parent_page_slug() . "https://wordpress.stackexchange.com/" . $pagename . '/?tipo=' . $dato->term_slug . '">' . $dato->name . ' (' . $dato->my_term_count . ')</a></li>';
$total += $dato->my_term_count;
}
if ( $show_all ){
echo '<li><a href="' . get_bloginfo('url') . "https://wordpress.stackexchange.com/" . get_parent_page_slug() . "https://wordpress.stackexchange.com/" . $pagename . "https://wordpress.stackexchange.com/">Todos (' . $total . ')</a></li>';
}
echo "</ul>";
}
my_custom_get_terms( 'tipo', get_parent_page_slug(), true );
thanks anyway