Forum Discussion
gregmhoffmann
7 years agoFrequent Visitor
Expense Forecasting From Static Excel Sheet
Hey Everyone! I have an Excel workbook that has a list of expenses, what day of the week they are due, and the frequency of the expense in months (shown below) Is there a way to crea...
- 7 years ago
Hello gregmhoffmann
Please check if this query does what you want
Table = SELECTCOLUMNS ( GENERATE ( Expenses, VAR __DayofMonth = Expenses[Due Date (Day of Mo)] VAR __StartDate = Expenses[Start Due Date] VAR __Frequency = Expenses[Frequency (in Mo)] VAR SameMonthDueDate = DATE ( YEAR ( __StartDate ), MONTH ( __StartDate ), __DayofMonth ) VAR NextMonthDueDate = EDATE ( SameMonthDueDate, 1 ) VAR FirstDueDate = IF ( SameMonthDueDate <= __StartDate, NextMonthDueDate, SameMonthDueDate ) VAR NumberOfPeriods = ROUNDUP ( DATEDIFF ( __StartDate, EDATE ( TODAY (), 12 ), MONTH ) / __Frequency, 0 ) RETURN ADDCOLUMNS ( GENERATESERIES ( 1, NumberOfPeriods ), "Test", EDATE ( FirstDueDate, ( [Value] - 1 ) * __Frequency ) ) ), "Expense", [Expense], "Payment Amount", [Payment Amount], "Date", [Test] )
LivioLanzo
7 years agoSolution Sage
Hello gregmhoffmann
Please check if this query does what you want
Table =
SELECTCOLUMNS (
GENERATE (
Expenses,
VAR __DayofMonth = Expenses[Due Date (Day of Mo)]
VAR __StartDate = Expenses[Start Due Date]
VAR __Frequency = Expenses[Frequency (in Mo)]
VAR SameMonthDueDate =
DATE ( YEAR ( __StartDate ), MONTH ( __StartDate ), __DayofMonth )
VAR NextMonthDueDate =
EDATE ( SameMonthDueDate, 1 )
VAR FirstDueDate =
IF ( SameMonthDueDate <= __StartDate, NextMonthDueDate, SameMonthDueDate )
VAR NumberOfPeriods =
ROUNDUP (
DATEDIFF ( __StartDate, EDATE ( TODAY (), 12 ), MONTH ) / __Frequency,
0
)
RETURN
ADDCOLUMNS (
GENERATESERIES ( 1, NumberOfPeriods ),
"Test", EDATE ( FirstDueDate, ( [Value] - 1 ) * __Frequency )
)
),
"Expense", [Expense],
"Payment Amount", [Payment Amount],
"Date", [Test]
)gregmhoffmann
7 years agoFrequent Visitor