Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
ca3868077
Contributor II
Contributor II

Data Load Editor - Invalid Expression - Summation of fields based upon conditional

Hello,

 

I'm receiving an error in the Data Load Editor, "Invalid Expression".  I believe it's due to how I've formatted  the 2nd formula (alias 'RO'), but I can't figure out how to resolve the issue.

LOAD

if (ALD_auth_qty>0,'Y','N') as ald_auth_qty_flag,
 
if (ALD_auth_qty>0,
        (Sum(ALD_auth_qty) + Sum(amds_auth_qty + namds_auth_qty + wisds_auth_qty) + Sum(hpmsk_deployed_qty)),
         (Sum(total_demand_level + spds_on_hand_qty)+Sum(amds_auth_qty + namds_auth_qty + wisds_auth_qty) +  Sum(hpmsk_auth_qty)
    )
) as RO
 
 
 
Is the issue caused because I'm summing dimensions through the sum() function while also using the sum operators (+)?
Conceptually, this formula, in my mind, does not work due to the row-context of a table..
 
Thoughts and feedback are greatly appreciated!
 
    
Labels (1)
1 Reply
BrunPierre
Partner - Master
Partner - Master

Hi, perhaps something like this

LOAD  Field1,
      Field2,
Sum(If(ALD_auth_qty>0, ALD_auth_qty + (amds_auth_qty + namds_auth_qty + wisds_auth_qty) + hpmsk_deployed_qty, (total_demand_level + spds_on_hand_qty) + (amds_auth_qty + namds_auth_qty + wisds_auth_qty) + (hpmsk_auth_qty)) ) as RO
Resident YourSourceTable
Group By Field1, Field2;