Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Cumulative values on period

Hi everyone,   So I am triyng to get the sum of values between two dates column, this is a sample of the data :   ContractID Start End ContractRevPerYear 0000...
  • Vvelarde's avatar
    9 years ago

    Anonymous

     

    hi, please try this:

     

    RevenueGenerated =
    
    VAR revenue =
        IF (
            HASONEVALUE ( 'Calendar'[Year] ),
            IF (
                YEAR ( VALUES ( Table1[End] ) ) <= VALUES ( 'Calendar'[Year] ),
                YEAR ( VALUES ( Table1[End] ) ) - YEAR ( VALUES ( Table1[Start] ) );
                VALUES ( 'Calendar'[Year] ) - YEAR ( VALUES ( Table1[Start] ) )
            )
                * CALCULATE ( AVERAGE ( Table1[ContractRevPerYear] ) )
        )
    RETURN
        IF ( revenue > 0, revenue, BLANK () )