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: 
johngouws
Partner - Specialist
Partner - Specialist

Sum value of last period

I need to sum the distance traveled on weekends for the last period (BaseMonth ). Because it is a common calendar, the last BaseMonth is actually December but my DateType 'Movement' is in July (BaseMonth 24235). When I select DateType 'Movement' and Weekends flag '1' the answer is correct. When I create the expression with Set Analysis, it gives zero as the result. Expressions I have tried are, 

"sum({<DateType={'Movement'},Weekends={'1'},[_BaseMonth]={"$(=max([_BaseMonth]))"}>}Distance)" or 

"sum({<DateType={'Movement'},Weekends={'1'},[_BaseMonth]={'$(=max([_BaseMonth]))'}>}Distance)" but no success. The snippets show when making selections, the results are correct, but in the set analysis it does not give correct result. 

Please can you let me know where I am doing something wrong.  

Snip_3.JPG

 

2 Replies
sunny_talwar

May be this

Sum({<DateType = {'Movement'}, Weekends = {'1'}, [_BaseMonth] = {'$(=MaxString([_BaseMonth]))'}>} Distance)
johngouws
Partner - Specialist
Partner - Specialist
Author

Hi Sunny, 

Thanks, I have used this expression. It still only returns the result when I select either the Movement or weekend flag. 

As part of the testing, if I select the year 2019 and in a seperate text box I have this expression:   "firstsortedvalue({<[Year]={'$(=max([Year]))'},DateType={'Movement'},Weekends={'1'} >} [_BaseMonth], -Tx_Date)".  It returns the correct BaseMonth. I am wondering if there is a way of using this logic in the [_BaseMonth] logic? 

Thanks again for the help.