 <blockquote> <p>In your Block file</p> </blockquote> <pre><code>namespace "Your Module namespace"; class modelclass extends \Magento\Framework\View\Element\Template { /** @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactory */ protected $_orderCollectionFactory; /** @var \Magento\Sales\Model\ResourceModel\Order\Collection */ protected $orders; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory, array $data = [] ) { $this-&gt;_orderCollectionFactory = $orderCollectionFactory; parent::__construct($context, $data); } public function getOrders() { if (!$this-&gt;orders) { $this-&gt;orders = $this-&gt;_orderCollectionFactory-&gt;create()-&gt;addFieldToSelect('*'); } return $this-&gt;orders; } </code></pre> <blockquote> <p>In your phtml file</p> </blockquote> <pre><code>$_orders = $block-&gt;getOrders(); if ($_orders &amp;&amp; count($_orders)) { $complete = $pending = $closed = $canceled = $processing = $onHold = 0; foreach ($_orders as $_order) { $label = $_order-&gt;getStatusLabel(); switch ($label) { case 'Complete' : $complete++; break; case 'Pending' : $pending++; break; case 'Processing' : $processing++; break; case 'Canceled' : $canceled++; break; case 'Closed' : $closed++; break; } } echo "Order Status &lt;br&gt;"; echo "Completed Order " . $complete . "&lt;br&gt;"; echo "Pending Order " . $pending . "&lt;br&gt;"; echo "Closed Order " . $closed . "&lt;br&gt;"; echo "Canceled Order " . $canceled . "&lt;br&gt;"; echo "Processing Order" . $processing . "&lt;br&gt;"; } else{ echo "You have no Orders"; } </code></pre>