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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
countwise
Contributor III
Contributor III

RangeSum

I am trying to calculate a cumulative figure for a field (Traffic_In)

I require the accumulation to be calculated for open hours only (Site_ActiveHours). by date(Date) and by hour(Time24).

I am using the following expression for Cumu In.

Aggr(RangeSum(Above(TOTAL Sum(Traffic_In), 0,RowNo())),Site_ActiveHours=True(),Date,Time24)

Capture 1.PNGThis expression seems to work ok if the store opens at 9:00.

If the store opens at 8:00 the accumulation starts from 9:00 and adds the 8:00 figure at the end.(See image above.

Any help would be appreciated

Jim Diggins

 

 
 
1 Solution

Accepted Solutions
Anil_Babu_Samineni

Perhaps this way

RangeSum(Above(TOTAL Sum(Aggr(Sum({<Site_ActiveHours={'Open'}>} Traffic_In), Date, Time24)), 0,RowNo(TOTAL)))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

2 Replies
Anil_Babu_Samineni

Perhaps this way

RangeSum(Above(TOTAL Sum(Aggr(Sum({<Site_ActiveHours={'Open'}>} Traffic_In), Date, Time24)), 0,RowNo(TOTAL)))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
countwise
Contributor III
Contributor III
Author

Hi Anil,

Many thanks for this, it solves the issue I am having in a table and combo chart.

I have tried it i a Heat Map in this way:

If(
RangeSum(Above(TOTAL Sum(Aggr(Sum({<Site_ActiveHours={'-1'}>} Traffic_In), Date, Time24)), 0,RowNo(TOTAL)))
-
RangeSum(Above(TOTAL Sum(Aggr(Sum({<Site_ActiveHours={'-1'}>} Traffic_Out), Date, Time24)), 0,RowNo(TOTAL)))
<0,0
,
RangeSum(Above(TOTAL Sum(Aggr(Sum({<Site_ActiveHours={'-1'}>} Traffic_In), Date, Time24)), 0,RowNo(TOTAL)))
-
RangeSum(Above(TOTAL Sum(Aggr(Sum({<Site_ActiveHours={'-1'}>} Traffic_Out), Date, Time24)), 0,RowNo(TOTAL)))
)

The reason for the If is that if the returned value is negative I want it to show 0.

This is accumulating the result over the whole number of days.

I require it to show a daily accumulation and start again the next day.

The result needs to be a Heat Map with Time24 along the top and Date down the left.

Hope this makes sense

Jim