Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
xaelm
Contributor II
Contributor II

How would I implement this nested aggregation?

I'm developing an AR dashboard and I'm having trouble figuring out how to implement a days sales outstanding (DSO) metric for the entire company.

I'm successfully using the following expression to calculate DSO at the customer level:

 

sum(AMOUNT_DUE_LOCAL*Days_Past_Due)/sum(AMOUNT_DUE_LOCAL)

 


But when trying to use the following expression to calculate it for the entire company (while weighting a customer's total amount due relative to the entire company's amount due), I run into an error:

 

Sum(
  aggr(
   Sum(AMOUNT_DUE_LOCAL * Days_Past_Due)/Sum(AMOUNT_DUE_LOCAL), CUSTOMER_NUMBER)* Sum(AMOUNT_DUE_LOCAL))

/ Sum(TOTAL AMOUNT_DUE_LOCAL)

 


I've attached a simple Excel example of the desired functionality to clearly demonstrate what I'm trying to do.

Any thoughts?

Labels (2)
2 Replies
Anil_Babu_Samineni

Perhaps try this way

sum(TOTAL <Customer> (AMOUNT_DUE_LOCAL*Days_Past_Due))/sum(TOTAL <Customer> AMOUNT_DUE_LOCAL)

 

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
xaelm
Contributor II
Contributor II
Author

Unfortunately that did not work...