Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SQL Case Statement

$
0
0

Hi,

could you please advise how to add below New case to below Main case


New case:

when (convert(varchar,date,101) >= '01/01/2014' OR qtr >= '14Q1') then

case when PP='ABC' and pl='EFG' then Revenue*.552
else 0 end


Main case:

SUM(

case

when ((convert(varchar,date,101)>= '09/19/2013' and qtr = '13Q3') OR qtr >= '13Q4') then

case when PP='ABC' and pl='EFG' then Revenue*.542
else 0 end

when (convert(varchar,date,101) < '09/19/2013' OR qtr < '13Q3') then

case when PP='ABC' and pl='EFG' then Revenue*.501
else 0 end

else 0 end) revenue,


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>