I tried to understand your question, but I'm not sure if I understood :
CTE retrieves all months since last April and you want to display informations linked to RS_Sell_Order_Master
(Invoices, Inventory and Taxes...). This should mean, you have to display for all months since last April thoses details.
So maybe you just simply need to make match Periods
CTE months and years with RS_Sell_Order_Master
months and years.
So you just simply needs to do that :
FROM Periods as P
left outer join RS_Sell_Order_Master as SM
on MONTH(sm.is_approved) = MONTH(P.[Period])
and YEAR(sm.is_approved) = YEAR(P.[Period])
Here in the full code :
DECLARE @CurrentDate AS datetime = getdate();
DECLARE @FirstDayInCurrentMonth AS datetime = DATEADD(day, 1 - DATEPART(day, @CurrentDate), @CurrentDate);
DECLARE @LastApril AS datetime = DATEADD(month, -(DATEPART(month, @FirstDayInCurrentMonth) + 8) % 12, @FirstDayInCurrentMonth);
WITH Periods AS (
SELECT @LastApril AS [Period]
UNION ALL
SELECT DATEADD(month, 1, [Period])
FROM Periods
WHERE [Period] < @FirstDayInCurrentMonth
)
SELECT
DATENAME(month, [Period]),
DATEPART(year, [Period]),
MONTH(sm.is_approved) as [MONTH],
isnull(sum(ISM.selling_price * siim.qty),0) as Price,
isnull(sum(((tm.tax_amount*(ism.selling_price * siim.qty))/100)),0) as Tax,
isnull(sum((ism.selling_price * siim.qty) + (((tm.tax_amount*(ism.selling_price * siim.qty))/100))),0) as TotalPrice
FROM Periods as P
left outer join RS_Sell_Order_Master as SM
on MONTH(sm.is_approved) = MONTH(P.[Period])
and YEAR(sm.is_approved) = YEAR(P.[Period])
left outer join RS_Sells_Invoice_Info_Master as SIIM
on sm.sell_order_no = SIIM.sell_order_no
left outer join RS_Inventory_Selling_Master as ISM
on ISM.selling_product_id = SIIM.selling_product_id
left outer join RS_Tax_Master as TM
on Tm.tax_id = SIIM.tax_id
group by
DATENAME(month, [Period]),
DATEPART(year, [Period]),
MONTH(sm.is_approved)
If i'm wrong correct me, or if you have another issue just leave a comment.