Forum Discussion

mansi_luthra12's avatar
mansi_luthra12
New Member
2 years ago
Solved

Calculate sum based on start and end date

Hi All,  I need to calculate the sum of the amount based on the start and end date for each month. For example: In the below data TotalAmountPerMonth for Jan is 600 and For Feb it is only adding th...
  • v-zhangti's avatar
    v-zhangti
    2 years ago

    Hi, mansi_luthra12 

     

    Add a year column to the date table and add a year filter to the formula.

    Measure = 
    CALCULATE ( SUM ( 'Table'[Value] ),
        FILTER ( ALL ( 'Table' ),
            MONTH ( [StartDateScope] ) <= SELECTEDVALUE ( 'Date'[Month] )
                && MONTH ( [EndDateScope] ) >= SELECTEDVALUE ( 'Date'[Month] )
                &&YEAR([StartDateScope])=SELECTEDVALUE('Date'[Year])
        )
    )

    If you do not get the results you expect, please provide more detailed data.

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.