Reputation: 1216
Below is the code I currently using which I need to round the end result to 2 decimals. I am assuming that I have too many, too few, or in the wrong place when it comes to the "()" and my eyes are bleeding from trying to break it down and rebuild it. Can someone help me figure out what I did wrong.
,Round((((Sum(case when S.StatType = 'Slot' then S.CashIn - S.CashOut - S.JackPot Else 0 end)*.75)+
(Sum(case when S.StatType = 'Pit' then S.CashIn + S.CreditIn + S.ChipsIn + S.FrontIn - S.CashOut Else 0 end)*.4))/Nullif(Count(Distinct(S.GamingDate)),0)),2) as ADL
Upvotes: 0
Views: 157
Reputation: 396
Cast it as a decimal instead of rounding:
CAST((((Sum(case when S.StatType = 'Slot' then S.CashIn - S.CashOut - S.JackPot Else 0 end)*.75)+
(Sum(case when S.StatType = 'Pit' then S.CashIn + S.CreditIn + S.ChipsIn + S.FrontIn - S.CashOut Else 0 end)*.4))/Nullif(Count(Distinct(S.GamingDate)),0)) AS DECIMAL(18,2)) as ADL
Upvotes: 1