Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Where would you insert the AS function

$
0
0

Hi,

I am copying the below code from another sql statement which works in an old version of excel power pivot, unfortunatly the new version does not allow blank column names.  The error message I get is 'A column name cannot be blank'

Where in the following code would I put 'AS total_cpi'

See below for the code.  

CASE
                  WHEN ( t3."specY" > 0) THEN t3."specY"
                  ELSE t3."calcY"
         END *
         CASE
                  WHEN ( t3."specX" > 0) THEN t3."specX"
                  ELSE t3."calcX"
         END ,
         CASE
                  WHEN( t3."specX" > 0) THEN t3."specX"
                  ELSE t3."calcX"
         END ,
CASE
                  WHEN
                           CASE
                                    WHEN ( t3."specY" > 0) THEN t3."specY"
                                    ELSE t3."calcY"
                           END *
                           CASE
                                    WHEN ( t3."specX" > 0) THEN t3."specX"
                                    ELSE t3."calcX"
                           END > 0 THEN
                           CASE
                                    WHEN ( t3."chargfl" = 'Y') THEN t7."cpi"
                                    ELSE 0
                           END / (
                           CASE
                                    WHEN ( t3."specY" > 0) THEN t3."specY"
                                    ELSE t3."calcY"
                           END *
                           CASE
                                    WHEN (
                                                      t3."specX" > 0) THEN t3."specX"
                                    ELSE t3."calcX"
                           END )
                  ELSE 0
         END 

Thanks

Chris



Viewing all articles
Browse latest Browse all 7129

Trending Articles



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