Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
IMPORTANT: Upcoming LEF Database Maintenance, Oct. 3rd - SEE DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

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 (2)
9 Replies
Highlighted
Partner
Partner

I have attached the example file in the attachment.

Highlighted

Try this expression

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

Or this if Days are not sorted in the script

Aggr(RangeSum(Above(Value, 0, RowNo())), Flag, (Days, (NUMERIC)))
Highlighted
Partner
Partner

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

Highlighted
Partner
Partner

Attaching the file
Highlighted
Partner
Partner

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

Highlighted

I am not sure I understand

Highlighted
Partner
Partner

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

Highlighted
Partner
Partner

Hi Sunny,

Is there is any help I can get?