Msg 4121, Level 16, State 1, Line 211
Cannot find either column "v" or the user-defined function or aggregate "v.MKTSegmentDetCode", or the name is ambiguous.
Select v.[DateKey],v.[MonthKey],v.[SubtotalAmount],
SUM(v.SubtotalAmount) OVER (Partition by v.[MKTSegmentDetCode](cast( month([Date])as varchar(2)) + cast( year([Date])as varchar(4)) ) ORDER BY [Date] ROWS UNBOUNDED PRECEDING) AS CumSalesAmount
From
(
Select CONVERT (char(8),i.InvoiceDate ,112) [DateKey],
LEFT(CONVERT (char(8),i.InvoiceDate,112),6) [MonthKey],
i ...
Go to the complete details ...