Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good afternoon, I am trying to add these fields together to get a total output. Qlickview is not liking the code even though it makes sense to me. i'm trying to get the total value for the field <Amount>
if(wildmatch(Rate_Category, 'M*'),Amount) as Measured_Value,
if(wildmatch(Rate_Category, 'A*'),Amount) as Assessed_Value,
if(wildmatch(Rate_Category, 'U*'),Amount) as Unmeasured_Value,
sum(Measured_Value)+sum(Assessed_Value)+sum(Unmeasured_Value) as sum_total
try with
if(wildmatch(Rate_Category, 'M*'),Amount) as Measured_Value,
if(wildmatch(Rate_Category, 'A*'),Amount) as Assessed_Value,
if(wildmatch(Rate_Category, 'U*'),Amount) as Unmeasured_Value,
if(wildmatch(Rate_Category, 'M*'),Amount)+ if(wildmatch(Rate_Category, 'A*'),Amount)+if(wildmatch(Rate_Category, 'U*'),Amount) as sum_total
You can't reference the renamed fields in the same Load statement, they are unknown to QV until the load finished.
You can use a preceding load though, to use these new field names:
LOAD *,
rangesum(Measured_Value,Assessed_Value,Unmeasured_Value) as sum_total;
LOAD
...
if(wildmatch(Rate_Category, 'M*'),Amount) as Measured_Value,
if(wildmatch(Rate_Category, 'A*'),Amount) as Assessed_Value,
if(wildmatch(Rate_Category, 'U*'),Amount) as Unmeasured_Value,
...
from Table;
try with
if(wildmatch(Rate_Category, 'M*'),Amount) as Measured_Value,
if(wildmatch(Rate_Category, 'A*'),Amount) as Assessed_Value,
if(wildmatch(Rate_Category, 'U*'),Amount) as Unmeasured_Value,
if(wildmatch(Rate_Category, 'M*'),Amount)+ if(wildmatch(Rate_Category, 'A*'),Amount)+if(wildmatch(Rate_Category, 'U*'),Amount) as sum_total
Thanks Juan, that hit the spot! Have a great weekend guys,thanks for the help!