Hi All,
I have a report in which few metrics are calculated using other metrics in the report. These metrics are created using ApplySimpe and CASE statements.
The problem is the SQL generated is very complicated and it is bigger that 64kb.
Eg: SELECT (des_amt * 20) as a
,(CASE WHEN (des_amt * 20) > 24
THEN des_des * 0.01
ELSE (des_amt * 20) ) as b
,(CASE WHEN (CASE WHEN (des_amt * 20) > 24
THEN des_des * 0.01
ELSE (des_amt * 20) ) > 50
THEN (des_amt * 20)
ELSE des_des * 0.01) as c
,......
goes on....
What I would like to see is
SELECT (des_amt * 20) as a
,(CASE WHEN a > 24
THEN des_des * 0.01
ELSE a ) as b
,(CASE WHEN b > 50
THEN a
ELSE b) as c
,.........
Can any one tell me which VLDB properties will help me to achieve this OR if there is any other way?
Thanks
-Sri
I have a report in which few metrics are calculated using other metrics in the report. These metrics are created using ApplySimpe and CASE statements.
The problem is the SQL generated is very complicated and it is bigger that 64kb.
Eg: SELECT (des_amt * 20) as a
,(CASE WHEN (des_amt * 20) > 24
THEN des_des * 0.01
ELSE (des_amt * 20) ) as b
,(CASE WHEN (CASE WHEN (des_amt * 20) > 24
THEN des_des * 0.01
ELSE (des_amt * 20) ) > 50
THEN (des_amt * 20)
ELSE des_des * 0.01) as c
,......
goes on....
What I would like to see is
SELECT (des_amt * 20) as a
,(CASE WHEN a > 24
THEN des_des * 0.01
ELSE a ) as b
,(CASE WHEN b > 50
THEN a
ELSE b) as c
,.........
Can any one tell me which VLDB properties will help me to achieve this OR if there is any other way?
Thanks
-Sri