Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum Prior and Current Date Help

Hi All,

I'm trying to get this sum prior and current date working. What I did, I assigned 2 variables for the current and prior date. Please help and see below expression.

Prior Date:

vMinDate=Max({<END_Date={"<$(=MonthStart(Max(END_Date)-1))"}>} END_Date)

Current Date:

vMaxDate=Max({<END_Date={"<$(=MonthStart(Max(END_Date)0))"}>} END_Date)

=sum({<END_Date = {">$(vMinDate)<=$(vMaxDate)"}, [Type]={'Income: Other'}>} [Amount])

where I try to accomplish here is to sum where <= '12/31/15' (vMaxDate)  > '11/30/15' (vMinDate) with  Type = 'Income: Other'

Many Thanks

Frank

1 Solution

Accepted Solutions
sinanozdemir
Specialist III
Specialist III

Hi,

Try with "=" inside the dollar sign expansions:

=sum({<END_Date = {">$(=vMinDate)<=$(=vMaxDate)"}, [Type]={'Income: Other'}>} [Amount])

View solution in original post

4 Replies
sinanozdemir
Specialist III
Specialist III

Hi,

Try with "=" inside the dollar sign expansions:

=sum({<END_Date = {">$(=vMinDate)<=$(=vMaxDate)"}, [Type]={'Income: Other'}>} [Amount])

sunny_talwar

Also I would add Date() function around the variables with the required formatting, because set analysis only works when LHS have the same formatting as RHS. Currently your RHS will be converted to Number when you use Max function with it:

Prior Date:

vMinDate = Date(Max({<END_Date={"<$(=MonthStart(Max(END_Date)-1))"}>} END_Date), 'YourDateFormatHere')

Current Date:

vMaxDate = Date(Max({<END_Date={"<$(=MonthStart(Max(END_Date)0))"}>} END_Date), 'YourDateFormatHere')

Anonymous
Not applicable
Author

Thanks Sinan!!! works fine with the '=' added

Anonymous
Not applicable
Author

Sunny - Thanks for the information.