$query=Custum::find()->joinWith('order')->where(['id'=>101])
$count_custom=$query->count(); $query = Custum::find()->joinWith('order')->where(['id'=>101]); // возвращает ActiveRecord с условием where
$count_custom = $query->count(); // считает с условием where
$query->andWhere(условие); // добавляет $query условие andWhere, теперь в нем два условия: where и andWhere$query->andWhere() меняет объект $query. Если вам надо применить разные условия, используйте конструкцию (clone $query)->andWhere().