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
chrismpbi
Frequent Visitor

Split average of sum between start and end date

Hi,

 

I would like to calculate the average of a sum and split it between the start and end date.

Hope somebody can help me with this. Chris

 

 

Unbenannt.jpg

4 REPLIES 4
v-yulgu-msft
Employee
Employee

Hi @chrismpbi,

 

Suppose the dataset is look like below. If there isn't a [No] column to identify each row uniquely, you should add an index column in Query Editor mode first.

1.PNG

 

Create a calendar table.

Dim Date =
FILTER (
    ADDCOLUMNS (
        CALENDAR ( MIN ( 'Test Data1'[Start Date] ), MAX ( 'Test Data1'[End Date] ) ),
        "Month", FORMAT ( [Date], "MMM" )
    ),
    DAY ( [Date] ) = 1
)

2.PNG

 

New a calculated table to CrossJoin above two tables. And add a calculated column [Average Per month]

CrossJoin =
FILTER (
    CROSSJOIN ( 'Test Data1', 'Dim Date' ),
    'Dim Date'[Date] >= 'Test Data1'[Start Date]
        && 'Dim Date'[Date] <= 'Test Data1'[End Date]
)

Average per month =
'CrossJoin'[Amount]
    / CALCULATE (
        COUNT ( 'CrossJoin'[Month] ),
        ALLEXCEPT ( 'CrossJoin', 'CrossJoin'[No] )
    )

3.PNG

 

Use a Matrix to analyse data.

4.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yuliana,

 

thanks for your response! It seems to work but the month by which the amount is divided should be independent from the date filters. in the screenshot below the amount is just divided through the month that are in the selected year.

 

Screen Shot 07-25-18 at 10.50 AM.jpg

 

 

jthomson
Solution Sage
Solution Sage

There's a few posts on how to do this, but a bit more info would be useful - are you just splitting it by months? Does it matter how much of a month a project is running for? What were you doing in May?

Hi Jthomson,

 

This is just an example dataset. I have a few thousand lines with project costs. I would like to split those costs over the project duration. It would be good if I could also split it per day but its not necessary.

 

Christoph

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.