Forum Discussion
JarnoVisser
7 years agoHelper I
Forecasting per quarter
Hello, I have debt collections with a start and enddate. They have different frequencies like the following table: ID Startdate Enddate Amount Frequency 1 1-1-2017 31-12-2019 10 Mon...
- 7 years ago
You are going to need to modify your table with this DAX and create a new table:
Modified Data = SELECTCOLUMNS( GENERATE( Data, VAR Freq = Data[Frequency] VAR NumberOfPeriods = SWITCH( Freq, "Monthly", DATEDIFF( Data[Startdate], Data[Enddate], MONTH ), "2 Months", INT( DATEDIFF( Data[Startdate], Data[Enddate], MONTH ) / 2 ), "Quarterly", DATEDIFF( Data[Startdate], Data[Enddate], QUARTER ), "Half Year", INT( DATEDIFF( Data[Startdate], Data[Enddate], MONTH ) / 6 ), "Yearly", DATEDIFF( Data[Startdate], Data[Enddate], YEAR ), "Once", 0 ) RETURN GENERATESERIES( 0, NumberOfPeriods ) ), "ID", [ID], "Amount", [Amount], "Frequency", [Frequency], "Date", SWITCH( [Frequency], "Monthly", EDATE( [Startdate], [Value] ), "2 Months", EDATE( [Startdate], [Value] * 2 ), "Quarterly", EDATE( [Startdate], [Value] * 3 ), "Half YEar", EDATE( [Startdate], [Value] * 6 ), "Yearly", EDATE( [Startdate], [Value] * 12 ), "Once", [Startdate] ) )Then you are able to build this simple model and get the following results:
Data ModelResults
where the measure total amount is just:
Total Amount = SUM( 'Modified Data'[Amount] )let me know if you need to upload the pbix file
LivioLanzo
7 years agoSolution Sage
You are going to need to modify your table with this DAX and create a new table:
Modified Data =
SELECTCOLUMNS(
GENERATE(
Data,
VAR Freq = Data[Frequency]
VAR NumberOfPeriods =
SWITCH(
Freq,
"Monthly", DATEDIFF( Data[Startdate], Data[Enddate], MONTH ),
"2 Months", INT( DATEDIFF( Data[Startdate], Data[Enddate], MONTH ) / 2 ),
"Quarterly", DATEDIFF( Data[Startdate], Data[Enddate], QUARTER ),
"Half Year", INT( DATEDIFF( Data[Startdate], Data[Enddate], MONTH ) / 6 ),
"Yearly", DATEDIFF( Data[Startdate], Data[Enddate], YEAR ),
"Once", 0
)
RETURN GENERATESERIES( 0, NumberOfPeriods )
),
"ID", [ID],
"Amount", [Amount],
"Frequency", [Frequency],
"Date", SWITCH(
[Frequency],
"Monthly", EDATE( [Startdate], [Value] ),
"2 Months", EDATE( [Startdate], [Value] * 2 ),
"Quarterly", EDATE( [Startdate], [Value] * 3 ),
"Half YEar", EDATE( [Startdate], [Value] * 6 ),
"Yearly", EDATE( [Startdate], [Value] * 12 ),
"Once", [Startdate]
)
)Then you are able to build this simple model and get the following results:
Data ModelResults
where the measure total amount is just:
Total Amount = SUM( 'Modified Data'[Amount] )
let me know if you need to upload the pbix file
- JarnoVisser7 years agoHelper I
Thank you Livio!
This is exactly what I needed, it works perfect!
Regards,Jarno