I have a column in a query that calculates regsales base on some Id's and dont think my CASE statement is correct.
SUM (LOTOSMIS_ACC_TYPE.sing_ind * LOTOSMIS_RET_DAILY.grs_amn *
iif( gm_cd in (1105, 2123, 2124, 2150, 2152, 2191, 2192, 5143, 5145, 5146, 5245, 5253 ), switch(LOTOSMIS_RET_DAILY.gm_var=1, 0, TRUE, 1), 0)) AS RegSales
What I have tried so far which I dont think is working.
Sum(T.SING_IND * P.GRS_AMN *
CASE
WHEN
P.gm_cd in (1105, 2123, 2124, 2150, 2152, 2191, 2192, 5143, 5145, 5146, 5245, 5253 )
THEN 1
else 0 end) as RegSales
What am I doing wrong here?
SUM (LOTOSMIS_ACC_TYPE.sing_ind * LOTOSMIS_RET_DAILY.grs_amn *
iif( gm_cd in (1105, 2123, 2124, 2150, 2152, 2191, 2192, 5143, 5145, 5146, 5245, 5253 ), switch(LOTOSMIS_RET_DAILY.gm_var=1, 0, TRUE, 1), 0)) AS RegSales
What I have tried so far which I dont think is working.
Sum(T.SING_IND * P.GRS_AMN *
CASE
WHEN
P.gm_cd in (1105, 2123, 2124, 2150, 2152, 2191, 2192, 5143, 5145, 5146, 5245, 5253 )
THEN 1
else 0 end) as RegSales
What am I doing wrong here?