Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Expand a table using start and end dates

Hi there

 

I have a dataset that has a start and end date with 3 sets of numbers that I need to work out the monthly amount for and then put that amount in the correct month for each of the three amounts.

 

For example, row 1 starts on 1 Sep 20 and ends 31 Aug 21. The premium and comm are the upfront annual amounts so I need to populate a Premium Monthly field for Sep 2020 with 4,173.42, same for Oct, Nov etc to Aug 21. Then repeat that for Comm1 Monthly and Comm2 Monthly and then repeat that down the list to the bottom.

 

The end result would then allow me to run a pivot or cube in say Jul 21 that will return the total Premium, Comm1 and Comm2 that applies to that month. Can M or DAX do this and if so, please let me know how?

 

PeriodStartPeriodEndPremium Comm1 Comm2 MonthsPremium Monthly Comm1 Monthly Comm2 Monthly 
01/09/202031/08/202150,081.06-  10,016.21  12.004,173.42-  834.68
01/05/202130/04/2022165,021.5323,103.0133,004.31  12.0013,751.791,925.252,750.36
01/07/202130/06/202255,680.916,960.1111,136.18  12.004,640.08580.01928.02
01/07/202130/06/202212,373.19556.792,474.64  12.001,031.1046.40206.22
01/07/202130/06/2022171,295.917,708.3234,259.18  12.0014,274.66642.362,854.93
01/07/202130/06/2022161,189.687,253.5432,237.94  12.0013,432.47604.462,686.49
22/09/202131/08/202241,754.615,219.338,350.92  11.003,795.87474.48759.17
22/09/202131/08/2022237,962.0329,745.2547,592.41  11.0021,632.912,704.114,326.58
22/09/202131/08/2022785.4198.18157.08  11.0071.408.9314.28
01/11/202131/10/202257,557.507,194.69-    12.004,796.46599.56-  
01/11/202131/10/202233,012.024,621.686,602.40  12.002,751.00385.14550.20

 

2 Replies