Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rodri_morales
Creator II
Creator II

AVG of Dates

How can I get the AVG between the day the bill come and the day we paid the bill?

I make this:  =num(avg(day(DatePaymentBill-DateReceptionBill)), '##,##')

But I have a problem, sometimes we paid before the bill come (like a prepayment) and other times we paid after the bill come. So I wanna make 2 text object with this average.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try these two


Pre-paid:

=num(avg(if(DatePaymentBill<DateReceptionBill, DateReceptionBill -DatePaymentBill)), '##,##')


Paid afterwards:

=num(avg(if(DatePaymentBill>=DateReceptionBill, DatePaymentBill-DateReceptionBill )), '##,##')



talk is cheap, supply exceeds demand

View solution in original post

5 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Try something like this

avg(Aggr(DatePaymentBill-DateReceptionBill, BillID))

Gysbert_Wassenaar

Try these two


Pre-paid:

=num(avg(if(DatePaymentBill<DateReceptionBill, DateReceptionBill -DatePaymentBill)), '##,##')


Paid afterwards:

=num(avg(if(DatePaymentBill>=DateReceptionBill, DatePaymentBill-DateReceptionBill )), '##,##')



talk is cheap, supply exceeds demand
rodri_morales
Creator II
Creator II
Author

I do that, but I think it isn't the correct value. AVG(DatePaymentBill-DayReceptionBill) returns me the average in days?

rbecher
MVP
MVP

What else you are expecting? There is no average date.. However, you could add the avg days to the DayReceptionBill to get the expected DatePaymentBill if this makes sense.

Astrato.io Head of R&D
rodri_morales
Creator II
Creator II
Author

I want to know if the difference between DatePaymentBill and DateReceptionBill is in days. If not, I have to add the condition day()

I have this:

Without Prepayment

=num(avg(if(DatePaymentBill>=DayReceptionBill, DatePaymentBill-DateReceptionBill)), '##,##')

With Prepayment

=num(avg(DatePaymentBill-DateReceptionBill), '##,##')

If I add the function day() to the avg, the values are incorrect, because Without Prepayment < With Prepayment and thi isn't correct. Always AVG with Prepayment must be less than AVG without Prepayment