Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
shumailh
Creator III
Creator III

Correct Syntax required

What is the correct syntax for the below code?


sum({$<LoadDate = {"1/31/2009"}>} LCY_Amount)+
sum({$<LoadDate = {"2/28/2009"}>} LCY_Amount)+
sum({$<LoadDate = {"3/31/2009"}>} LCY_Amount)+
sum({$<LoadDate = {"4/30/2009"}>} LCY_Amount)+
sum({$<LoadDate = {"5/31/2009"}>} LCY_Amount)+
sum({$<LoadDate = {"6/30/2009"}>} LCY_Amount)+
sum({$<LoadDate = {"7/31/2009"}>} LCY_Amount)


Regards,
Shumail Hussain

2 Replies
prieper
Master II
Master II

Hi,

want do you want to do? The LoadDate is only one date and if on the end of the month you wish to summarize LCY_Amount?

Would a simple Sum(If(LoadDate = Floor(MonthEnd), LCY_Amount)) do the same?

Peter

johnw
Champion III
Champion III

If you're looking for the syntax for a list:

sum({<LoadDate={"1/31/2009","2/28/2009","3/31/2009","4/30/2009","5/31/2009","6/30/2009","7/31/2009"}>} LCY_Amount)

If you're looking for all load dates that occur on the end of the month, I'd probably do something like what Peter suggested:

sum(if(LoadDate=daystart(monthend(LoadDate)), LCY_Amount))

Or perhaps create a "Loaded on Last Day of Month?" flag, then:

sum({<"Loaded on Last Day of Month?"={1}>} LCY_Amount)

Or:

sum("Loaded on Last Day of Month?" * LCY_Amount)