Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Carpy
Contributor
Contributor

Set Analysis with Date Variables

Hi new here so apologies if others have answered this one - 

sum(
{<YearMonth,YearMonth={'>= $(vYearMonth2PrevToData) <= $(vYearMonthToData) '}>}
Amount)

The variable names aren't great but they are to drive the date back to when the data corresponds and they seem to be working fine in terms of matching the right date - however this sum results in 0 despite everything showing correct

OK - SUM({YearMonth,YearMonth={'>=20151 <=20153'}>}Amount)

If I just use one or the other variable it provides the answer so it has to have something to do with me trying to define the range to do the sum over.

Any help appreciated - even the learning I am doing suggests I have everything correct

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar

Can you try this

Sum({<YearMonth = {"$(='>=' & vYearMonth2PrevToData & '<=' & vYearMonthToData)"}>} Amount)

or

Sum({<YearMonth = {"$(='>=' & $(vYearMonth2PrevToData) & '<=' & $(vYearMonthToData))"}>} Amount)

 

View solution in original post

3 Replies
sunny_talwar

Can you try this

Sum({<YearMonth = {"$(='>=' & vYearMonth2PrevToData & '<=' & vYearMonthToData)"}>} Amount)

or

Sum({<YearMonth = {"$(='>=' & $(vYearMonth2PrevToData) & '<=' & $(vYearMonthToData))"}>} Amount)

 

Carpy
Contributor
Contributor
Author

Thank you so much Sunny for the quick reply - both seem to be working fine. 

Any reason why I had to define them as strings or in-case I have used the wrong terminology '>='

sunny_talwar

You can try this also

Sum({<YearMonth = {">=$(=vYearMonth2PrevToData)<=$(=vYearMonthToData)"}>} Amount)

or

Sum({<YearMonth = {">=$(=$(vYearMonth2PrevToData))<=$(=$(vYearMonthToData))"}>} Amount)