Forum Discussion
ManPi
6 years agoFrequent Visitor
Forecasting payment date with calculated average
Hi all, I could use some help with calculating a forecasted paymentdate of our customers. I have calculated the average paymentterm from the past payments. Average paymentterm = DATEDIFF (Boeking...
- 6 years ago
Hi, ManPi
There are two ways.
First way: You may create a calculated column and a measure as follows.
Average paymentterm Column = CALCULATE( AVERAGE('Table'[Days paid]), FILTER( ALLSELECTED('Table'), 'Table'[Customer] = EARLIER('Table'[Customer])&& NOT ISBLANK('Table'[Payment date]) ) ) Expected payment date = var _value = CALCULATE( SUM('Table'[Average paymentterm Column]), FILTER( ALLSELECTED('Table'), 'Table'[Customer] = MAX('Table'[Customer]) ) )- CALCULATE( SUM('Table'[Days paid]), FILTER( ALLSELECTED('Table'), 'Table'[Customer] = MAX('Table'[Customer]) ) ) return IF( ISBLANK(MAX('Table'[Payment date])), MAX('Table'[Invoice date])+_value, BLANK() )Second way: You may create two measures as below.
Average paymentterm Measure = CALCULATE( AVERAGE('Table'[Days paid]), FILTER( ALLSELECTED('Table'), 'Table'[Customer] = MAX('Table'[Customer])&& NOT ISBLANK('Table'[Payment date]) ) ) Expected payment date Measure = var _value = CALCULATE( SUMX( FILTER( ALLSELECTED('Table'), 'Table'[Customer] = MAX('Table'[Customer]) ), [Average paymentterm Measure] ) )- CALCULATE( SUM('Table'[Days paid]), FILTER( ALLSELECTED('Table'), 'Table'[Customer] = MAX('Table'[Customer]) ) ) return IF( ISBLANK(MAX('Table'[Payment date])), MAX('Table'[Invoice date])+_value, BLANK() )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
6 years agoCommunity Champion
So what are your expected results from that data?
ManPi
6 years agoFrequent Visitor
Hi Greg,
In my example I want to calculate the last two colums.
Kind regards,
Mandy