Grabbing how Many Posts by Month for a Dashboard Widget

Just Went over your code and it looks fine but you are missing the code blocks for your foreach loops so:

add_action('wp_dashboard_setup', 'dashboard_test');
function dashboard_test() {
    global $wp_meta_boxes;
    wp_add_dashboard_widget('month_dashboard', 'Reports Submitted for the Year',   'custom_test');
}

function custom_test(){
    global $wpdb;
    $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE   post_status="publish" AND post_type="report" ORDER BY post_date DESC");
    foreach($years as $year){
        $months = $wpdb->get_col("SELECT DISTINCT MONTH(post_date) FROM $wpdb->posts WHERE post_status="publish" AND post_type="report" AND YEAR(post_date) = '".$year."' ORDER BY post_date DESC");
        foreach($months as $month) {
            $month = ($month < 10)? '0' . $month : $month; 
            $theids = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status="publish" AND post_type="report" AND MONTH(post_date)= '".$month."' AND YEAR(post_date) = '".$year."' ORDER BY post_date ASC");
            echo '<h4>';
            echo '<li><a href="https://wordpress.stackexchange.com/report/".$year."https://wordpress.stackexchange.com/".$month.'">' . date( 'F', mktime(0, 0, 0, $month) ). ' (' . count($theids) . ')</a></li>' ;
            echo '</h4>';
        }
    }
}

and it works just fine:

enter image description here