Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
srini
Creator
Creator

Sum([Units]) AS "YTD Units" is giving syntax error!!

Hi Experts,

 

when I use this in my load scrip it shows the syntax error

Sum([Units]) AS "YTD Units"

not sure? getting confused

Labels (1)
5 Replies
sunny_talwar

Are you using Group by statement in the load where you are doing the Sum(Units) as "YTD Units"

srini
Creator
Creator
Author

Hi Sunny,

 

Nope I am not using Group by statement.

srini
Creator
Creator
Author

I have tried with group by statement but still shows the same error Test2: Load "Cycle Year", "Cycle Name", "Governance Group", "Product Line", "GPDM Portfolio", "GPDM Programme", "POB ID", "POB Name", "BP Priority", "BP ID (for filtering)", "BP Name", If( [Cycle Name] ='ACTUAL' AND MonthNum<=Num(Month(Today())), Units) AS "YTD Actuals", If( [Cycle Name] ='FORECAST' AND MonthNum<=Num(Month(Today())), Units) AS "YTD FORECAST", Sum([Units]) AS "YTD Units" Resident Test1 Group BY [Units],[Cycle Year],[Cycle Name],[BP ID (for filtering)]; Drop Table Test1;
jonathandienst
Partner
Partner

Every item not in an aggregation (Sum / Max / Avg etc) must be included in the Group By.

Test2: 
Load 
	"Cycle Year", 
	"Cycle Name", 
	"Governance Group", 
	"Product Line", 
	"GPDM Portfolio", 
	"GPDM Programme", 
	"POB ID", 
	"POB Name", 
	"BP Priority", 
	"BP ID (for filtering)", 
	"BP Name", 
	If( [Cycle Name] ='ACTUAL' AND MonthNum<=Num(Month(Today())), Units) AS "YTD Actuals", 
	If( [Cycle Name] ='FORECAST' AND MonthNum<=Num(Month(Today())), Units) AS "YTD FORECAST", 
	Sum([Units]) AS "YTD Units" 
Resident Test1 
Group BY "Cycle Year", 
	"Cycle Name", 
	"Governance Group", 
	"Product Line", 
	"GPDM Portfolio", 
	"GPDM Programme", 
	"POB ID", 
	"POB Name", 
	"BP Priority", 
	"BP ID (for filtering)", 
	"BP Name", 
	If( [Cycle Name] ='ACTUAL' AND MonthNum<=Num(Month(Today())), Units),
	If( [Cycle Name] ='FORECAST' AND MonthNum<=Num(Month(Today())), Units)
;

Drop Table Test1;
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
srini
Creator
Creator
Author

Thanks Jonty!