Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mohan_1105
Partner - Creator III
Partner - Creator III

Rangesum based on flag condition

Hi Qliker,

I was facing a challenge to perform the calculation in the front end.

The cumulation need to be done based on the flag as a condition,

below is the example,

DaysFlagValueOutputCalculation 
1150  
22100  
33100  
411015(10+15)Cumulating all records above having flag 1
521020(10+10)Cumulating all records above having flag 2
63616(10+6)Cumulating all records above having flag 3
71419(10+15+4)Cumulating all records above having flag 1
82626(10+10+6)Cumulating all records above having flag 2
93824(10+6+8)Cumulating all records above having flag 3

 

The requirement is such a way, the calculation has cannot be done in the backend.

Please help us with the expression.

 

Thanks in advance,

Mohan

 

Labels (1)
9 Replies
mohan_1105
Partner - Creator III
Partner - Creator III
Author

I have attached the example file in the attachment.

sunny_talwar

Try this expression

Aggr(RangeSum(Above(Value, 0, RowNo())), Flag, Days)
sunny_talwar

Or this if Days are not sorted in the script

Aggr(RangeSum(Above(Value, 0, RowNo())), Flag, (Days, (NUMERIC)))
mohan_1105
Partner - Creator III
Partner - Creator III
Author

Hi Sunny, 

 

Thanks for the reply.

The expression is working perfectly, in the sample file shared. I tried to apply the same in my file, it bit tricky for me to understand the expression in what way it goes wrong. 

Please have a look at the attached application, in which I'm working on.

Kindly help..!!

 

Regards,

Mohan

mohan_1105
Partner - Creator III
Partner - Creator III
Author

Attaching the file
mohan_1105
Partner - Creator III
Partner - Creator III
Author

Hi Sunny,

To be clear on what I'm trying to achieve is to roll up every 20th from the start.

Assuming the fact the person leaves at every 20th day, no. of people leaves creates the vacant for next day (21st Day). Thats the reason why the Flag column is created to rolling down the values every 20 days.

Hope the above logic description is understandable.

Regards,

Mohan

sunny_talwar

I am not sure I understand

mohan_1105
Partner - Creator III
Partner - Creator III
Author

As I explained in the header example, I need to accumulate the values of the 3rd record respectively. The expression suggested is working fine in the provided sample file.

When I tried to apply the same in the application(recently attached qvf) in which I'm working on. The expression isn't working correctly as expected.

In the previous reply, I tried to explain the business behind the logic I'm working on. If open the qvf, the patient admitted is the same, for 1st cycle which is 1-20 days, when the next cycle starts, 1st cycle patient moves away and beds occupied by them is assigned to the person comes in 2nd cycle (21-40 days). Likewise, it goes on till the date entered in the data.

 

Regards,

Mohan

mohan_1105
Partner - Creator III
Partner - Creator III
Author

Hi Sunny,

Is there is any help I can get?