Please check the data in [VW_Fact_Inventory_All]
where year(cast(cast (skDateTransaction as varchar(10)) as date)) = 2021 and month(cast(cast (skDateTransaction as varchar(10)) as date)) = 10
And I guess there are far more than 31 rows in 2021.October.
select sum(decQtyIn)/31 as pcs_stockin,avg(decQtyIn) as pcs_stockin,
they should return same values
They only return same values when there are exactly 31 rows of data in October
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.