
VAR StartYear = 2009
VAR EndYear = 2017
VAR CurrentCompanyID = SELECTEDVALUE(COMPANIES[COMPANYID])  -- Capture the current company context
RETURN
    AVERAGEX(
        FILTER(
            VALUES(Dates[Year]),
            Dates[Year] >= StartYear && Dates[Year] <= EndYear
        ),
        CALCULATE(
            SUM(STATEMENTDATA[VALUE]),
            STATEMENTLINES[LINEITEM] = "REVENUE",  -- Filter for revenue
            STATEMENTDATA[COMPANYID] = CurrentCompanyID  -- Current Company context
        )
    ) * 1000000