Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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)
3 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... 

Anil_Babu_Samineni

When you say it doesn't help, Do you mean this is not worked anything or no result or any error? 

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