Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
YashPatel0106
Partner - Contributor II
Partner - Contributor II

Error in Cumulative Sum in Qliksense Table

Hi All,

I am facing some issue while calculating cumulative sum in Qliksense Table.

Following is the expression :

Sum(Aggr(RangeSum(Above(If(Column(5)='No'
,0,If(OrderDate=Date(BillDate,'DD-MM-YYYY'),Sum(OrderQty)-Sum(BilledQty),Sum(OrderQty))),0, RowNo())),DepotCode,MaterialNo,OrderDate,Key))

where Column(5) is the inscope column 

InkedCapture_LI.jpg

Expected Cumulative Remaining Qty
0
0
3

8

 

Please give your valuable feedback and Thanks in Advance.

 

Regards,

Yash P.

 

Labels (2)
1 Solution

Accepted Solutions
YashPatel0106
Partner - Contributor II
Partner - Contributor II
Author

The issue got solved.

Used Sorting in AGGR.

(Aggr(RangeSum(Above( Sum(RemainingQty), 0, RowNo(TOTAL))),(DepotCode,TEXT,ASCENDING),(MaterialNo,TEXT,ASCENDING),(OrderDate,Numeric,ASCENDING),(Key,Text,ASCENDING)))

 

Thanks For Your Support.

View solution in original post

11 Replies
sunny_talwar

You can add column reference within the Aggr() function... you need to replace Column(5) with the actual expression behind that column.

YashPatel0106
Partner - Contributor II
Partner - Contributor II
Author

We Tried that too but it gives the same output.

 

Following the expression :

Sum(Aggr(RangeSum(Above(If(if((((Norm)/Right(MaterialNo,6))*1000) >0 and Num(Sum(OrderQty),'#,##0.00') <(0.33 * (((Norm)/Right(MaterialNo,6))*1000) ),'Yes','No')='No',0,If(OrderDate=Date(BillDate,'DD-MM-YYYY'),Sum(OrderQty)-Sum(BilledQty),Sum(OrderQty))), 0, RowNo())),DepotCode,MaterialNo,OrderDate,Key))

//If Inscope value is 'No' then remaining qty will be zero and if orderdate and billing date is not same then remaining qty will be same as order qty.

sunny_talwar

What is Key here? may be you need to sort Key

DepotCode, MaterialNo, OrderDate, (Key, (NUMERIC))

 

YashPatel0106
Partner - Contributor II
Partner - Contributor II
Author

Key is the composite of Material and Invoice no used to join Order table and billed table from where Billed Qty is coming.

Cumulative Sum need to be aggregated when DepotCode , Materialno and Orderdate are same.

sunny_talwar

You might have already tried this, but is this not working?

RangeSum(Above(
  If(Column(5) = 'No', 0, 
    If(OrderDate = BillDate, 
      Sum(OrderQty) - Sum(BilledQty), 
      Sum(OrderQty)
    )
  )
, 0, RowNo()))
YashPatel0106
Partner - Contributor II
Partner - Contributor II
Author

No, It is not working, below is the screenshot.

Capture2.PNG

sunny_talwar

Would you be able to share a sample to check this out?

YashPatel0106
Partner - Contributor II
Partner - Contributor II
Author

PFA sample app.

sunny_talwar

What selections do I make to see the above scenarios?