Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD Calculation

MonthIdVolume
120
221
324
425
522
633
723
843
934
1032
1128
1230
This is the dummy data i created. I have to calculte YTD. So in july i have to calculate sum of volume of MonthId=1 to MonthId=7. and my expression has to be dynamic so that it automatically adjusts if i move to next month.
I have used this expression for calculating YTD

=

rangesum((sum({$<MonthId ={1}>} Volume)), (sum({$<MonthId ={7}>} Volume)))

but its not giving me the correct value. It is just summing up MonthId 1 and 7 value giving 43 as the result. But i want the value to be sum of monthId 1 to 7 that is 168. How can i do that. In the second part of the expression i will make the monthid 7 value dynamic using variable so there is no concern about that but Rangesum is not working

Please someone help me out.

I have attached a sample qvw file.

1 Solution

Accepted Solutions
Not applicable
Author

This is my final expression where vMonth is a variable which will have the values 1,2,3---12 respectively based on the month i am in. So my expression will be dynamic.

=

sum({$<MonthId ={">=1<=$(vMonth)"}>} Volume)

Thanks everyone for your help

View solution in original post

5 Replies
Not applicable
Author

solution attached

Sokkorn
Master
Master

Hi sumitharsh,

Let try this set analysis : sum({$<MonthId ={">=1<=7"}>} Volume)

Do let me know.

Regards,

Sokkorn

jagan
Partner - Champion III
Partner - Champion III

Hi,

Use this expression

=sum({<MonthId ={'>=1<=7'}>} Volume)

Regards,

Jagan.

Not applicable
Author

You could, but that would not be dynamic, what happens next month?   Regards  Rahul

Not applicable
Author

This is my final expression where vMonth is a variable which will have the values 1,2,3---12 respectively based on the month i am in. So my expression will be dynamic.

=

sum({$<MonthId ={">=1<=$(vMonth)"}>} Volume)

Thanks everyone for your help