You can fetch the record using bellow query
$posts= get_posts(array(
'numberposts' => -1,
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'date_query' => array(
'column' => 'post_date',
'after' => '-7 days' // -7 Means last 7 days
)
));
echo count($posts);
If you want to get last 6 month the use -6 Months