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: 
vjoshi2017
Contributor
Contributor

I want to simplify a rangesum expression

I have put a slider in my dashboard which signifies months after my price changes.

To get the cumulative sum for my order quantity , I have put the below expression - 

fabs(Pick(WildMatch($(POSTMONTH),0 , 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11,12,13,14,15,16,17,18),

Sum({<Post_months -= {"0"}>}ORDQTY_CL),
Sum({<Post_months = {"1"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11","12"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11","12","13"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"}>}ORDQTY_CL),
Sum({<Post_months = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17", "18"}>}ORDQTY_CL)))

This can not be scaled after few months. Can I write this expression in a better way?

What I am doing here is getting the cumulative sum corresponding to slider variable value. I am trying to use rangesum but not been able to.

POSTMONTH is the variable used in slider.

 

 

Thanks,

Vivek

Labels (2)
5 Replies
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

Can u attach Sample qvf with sample data so that it will help to others to try and get back to u ASAP

thanks

Thanks and Regards
Kashyap.R
marcus_sommer

You may try something in this way:

Sum({<Post_months = {"<=$(POSTMONTH)"}>}ORDQTY_CL)

- Marcus

Kashyap_R
Partner - Specialist
Partner - Specialist

Adding to @marcus_sommer 

IF($(POSTMONTH)>0

Sum({<Post_months = {"<=$(POSTMONTH)"}>}ORDQTY_CL),Sum({<Post_months -= {"0"}>}ORDQTY_CL))

Thanks

Thanks and Regards
Kashyap.R
vjoshi2017
Contributor
Contributor
Author

Both the expression doesn't give me same value.

 

 

marcus_sommer

Is any of them correct? I suggest to use them within a table-chart with this or that dimensions which should show where the differences come from and could be then further examined. Also keep an eye on the fact that my suggestion didn't handle the case of 0 - so you adjust them maybe in this way:

Sum({<Post_months = {">0<=$(POSTMONTH)"}>}ORDQTY_CL)

- Marcus