cancel
Showing results for
Did you mean:
Occasional Visitor

## Estimating monthly values from table using start date/end date

Hello everyone,

I have data that looks like this:

 Identifier Start Date End Date Usage Value ABCF1234 1/01/2015 28/02/2015 387 AFDV1345 1/01/2015 12/01/2015 234 AFDV1345 13/01/2015 31/01/2015 423

What I need to do is to have monthly values for each identifier, but the non-uniform start and end dates are giving me a bit of a headache. Ideal output would look like this:

 Identifier Month Usage Value ABCF1234 Jan-15 200 ABCF1234 Feb-15 187 AFDV1345 Jan-15 657

I realise this would be an estimation, but I just cant figure out a way to do this. I was thinking something along the lines of getting an avg daily value, but I have no idea how I would group those values into months.

Has anybody dealt with this kind of data before? Any help would be much appreciated.

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Estimating monthly values from table using start date/end date

Hi @MT

I think this might be getting close

Table =
GROUPBY(
FILTER(
CROSSJOIN(
-- Create and on the fly calendar table with a month column
CALENDARAUTO(),
"Month",FORMAT([Date],"MMM-YY")
),
-- Add a column to our base table that adds an average daily value
'Table1',
"Averate Usage Per Day",
DIVIDE(
'Table1'[Usage Value],
DATEDIFF(
'Table1'[Start Date],
'Table1'[End Date],DAY
)
)
)
),
'Table1'[Start Date] <= [Date] &&
'Table1'[End Date] >= [Date]
),
-- Perform the actual grouping here --
-- So Group by --
[Identifier],
[Month],
-- Now sum up the Average daily usage for the above groupings --
"Usage Value", SUMX(
CURRENTGROUP(),
[Averate Usage Per Day]
)
)

If I run this over your sample data I get the following result

Proud to be a Datanaut!

2 REPLIES 2
Super User

## Re: Estimating monthly values from table using start date/end date

Hi @MT

I think this might be getting close

Table =
GROUPBY(
FILTER(
CROSSJOIN(
-- Create and on the fly calendar table with a month column
CALENDARAUTO(),
"Month",FORMAT([Date],"MMM-YY")
),
-- Add a column to our base table that adds an average daily value
'Table1',
"Averate Usage Per Day",
DIVIDE(
'Table1'[Usage Value],
DATEDIFF(
'Table1'[Start Date],
'Table1'[End Date],DAY
)
)
)
),
'Table1'[Start Date] <= [Date] &&
'Table1'[End Date] >= [Date]
),
-- Perform the actual grouping here --
-- So Group by --
[Identifier],
[Month],
-- Now sum up the Average daily usage for the above groupings --
"Usage Value", SUMX(
CURRENTGROUP(),
[Averate Usage Per Day]
)
)

If I run this over your sample data I get the following result

Proud to be a Datanaut!

Highlighted
Super Contributor

## Re: Estimating monthly values from table using start date/end date

Hi @MT,

Have you tried the solution provided by @Phil_Seamark above? Does it work in your scenario? If it works, could you accept it as solution to close this thread?

If you still have any question on this issue, feel free to post here.

Regards