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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Oomsen
Helper III
Helper III

Forcast costs based on last 6 months

I would like to forecast my costs, based on the average cost in de last 6 months. The outcome of the measure should be presented for al future weeks/months, starting 30 days after today. This is to predict future payables. I will use this forecast in my cashflow prediction, which is a running total of payables, receivables and opportunities. 

 

I created: 

payables average weekly =
VAR week = WEEKNUM(TODAY())
VAR maand = MONTH(TODAY())
VAR jaar = YEAR(TODAY())
VAR datum = DATE(jaar,maand,1)
VAR date2 = EDATE(datum,-6)
VAR date3 = TODAY()
var z = CALCULATE([crediteuren actual],FILTER(ALL(Dimdate),Dimdate[Datum]>=date2&&Dimdate[Datum]<=date3))
VAR g = DIVIDE(z,26)
VAR h = IF(MIN(Dimdate[Datum])-30<=TODAY(),BLANK(),g)
RETURN h

This works to calculate the average costs, but when i add this measure to my running total, the value is dismissed. 

 

 

4 REPLIES 4
Oomsen
Helper III
Helper III

Something is going wrong in de running total of my cashflow. I think the date filtering in my expected costs is the reason, but i'm not sure.
The measure Cashflow is calculating the correct amounts in my opinion.

 

measure expected costs = 
VAR a = DIVIDE(-CALCULATE(SUM(Transacties[amountdc]),Transacties[type]IN{30,31},Grootboekrekeningen[glaccountcode]="1600",DATESBETWEEN(Dimdate[Datum],EDATE(TODAY(),-6),TODAY())),26)
VAR b = IF(MIN(Dimdate[Datum])>=TODAY(),a,BLANK())
RETURN b

measure 
Cashflow = Debiteuren[debiteuren totaal]+[to be invoiced]+Opportunity[opportunity totaal]-Crediteuren[crediteuren totaal]-[expected costs]

measure 
Cashflow RT = CALCULATE(
    [Cashflow],
    FILTER(
        ALLSELECTED('Dimdate'[Datum]),
        ISONORAFTER('Dimdate'[Datum], MAX('Dimdate'[Datum]), DESC)))

 

example.PNG

amitchandak
Super User
Super User

@Oomsen , As you already using a time filter, running total might not work well

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

or try like

 

CALCULATE(SUMx(values(Date[Date]),[payables average weekly ] ) ,filter(allselected('Date'),'Date'[date] <=max('Date'[date])))

 

@amitchandak below same sample data.
receivables are from my ERP
payables are from my ERP
costs are historical from GL payables (ERP)
expected are average costs last 6 months
cashflow is receivables - payables - expected
running total is sum of cashflow

MonthWeekreceivablesPayablesCostsExpectedCashflowRunning total
jan1  50   
 2  100   
 3  50   
 4  25   
 5  75   
feb6  50   
 7  100   
 8  50   
 9  100   
mrt10  50   
 11  25   
 12  75   
 13  50   
apr14  100   
 15  50   
 16  100   
 17  50   
may18  25   
 19  75   
 20  50   
 21  100   
 22  50   
jun23  100   
 24  50   
 25  25   
 26  75   
jul27  50   
 28  100   
 29  50   
 30  100   
aug31  50   
 32  25   
 33  75   
 34  50   
 35  100   
sep366010  5050
 3710040  60110,00
 384030  10120,00
 392520  5125,00
 405015  35160,00
okt41   63,46-63,4696,54
 42   63,46-63,4633,08
 43   63,46-63,46-30,38
 44   63,46-63,46-93,85
nov45   63,46-63,46-157,31
 46   63,46-63,46-220,77
 47   63,46-63,46-284,23
 48   63,46-63,46-347,69
dec49   63,46-63,46-411,15
 50   63,46-63,46-474,62
 51   63,46-63,46-538,08
 52   63,46-63,46-601,54
        

Any suggestions?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.