I want to write a case when logic with sum aggregation for Month_value.
these are the conditions i recv for DEPT_VISITS:
i tried to put this way within case when:
SUM(CASE WHEN Account =(88000400)
OR (PROG = 67900 and Account =88000000)
OR (PROD = 67900 and ACCOUNT=88000200)
OR (PROG=67900 and ACCOUNT=88000500)
Is the below logic better incorporating above conditions all:, please advise.
SUM(CASE WHEN Sub_Account =(88000400) then mth_value
when PROG = 67900 and Account =88000000 then mth_value
when PROG = 67900 and ACCOUNT=88000200 then mth value
when PROG=67900 and ACCOUNT=88000500 then mth_value
Thanks a lot for the helpful info.