Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
laureadiaz
Contributor III
Contributor III

Load New Field using IF and Group BY (AGGR in expressions)

Hello,

 

   I am trying to speed up my dashboard by creating new fields in the load.

 

this is one example from the expression I was using:

(Sum

(IF((AGGR(cost_ext_sales, Short_ID, sales_number, Inside_Sales, month, year)>0)

and (AGGR(quantity_sales, Short_ID, sales_number, Inside_Sales, month, year)>0)

and (AGGR(Price_ext_sales, Short_ID, sales_number, Inside_Sales, month, year)>0),

(Price_ext_sales))))

 

How do I transform this to a new field in a load script, assuming all of these fields are in one table, I know I cannot use AGGR but not sure on syntax with Group By?

Thanks!

2 Replies
laureadiaz
Contributor III
Contributor III
Author

I'm trying this, fingers crossed

Left Join (Sales)
LOAD
company_code&type_code&sales_number&line_number as [sales_key],
SUM(Price_ext_sales) as cPrices
Resident Sales
Where cost_ext_sales>0
and quantity_sales>0
and Price_ext_sales>0
Group By Short_ID, sales_number, Inside_Sales, month, year;

 

laureadiaz
Contributor III
Contributor III
Author

Got an "iinvalid expression" script error?

 

Maybe cause I am joining to the same resident table?

 

Any ideas?