
VAR StartYear = 2009
VAR EndYear = 2017
VAR Industry = SELECTEDVALUE(COMPANIES[INDUSTRY])
VAR CurrentCompany = SELECTEDVALUE(COMPANIES[COMPANYID])

VAR BeginningValue = 
    CALCULATE(
        SUM(STATEMENTDATA[VALUE]),
        STATEMENTLINES[LINEITEM] = "REVENUE",
        DATES[Year] = StartYear,
        COMPANIES[INDUSTRY] = Industry,
        COMPANIES[COMPANYID] <> CurrentCompany,
        REMOVEFILTERS(COMPANIES)
    )

VAR EndingValue = 
    CALCULATE(
        SUM(STATEMENTDATA[VALUE]),
        STATEMENTLINES[LINEITEM] = "REVENUE",
        DATES[Year] = EndYear,
        COMPANIES[INDUSTRY] = Industry,
        COMPANIES[COMPANYID] <> CurrentCompany,
        REMOVEFILTERS(COMPANIES)
    )

VAR NumberOfYears = EndYear - StartYear

RETURN
    IF(
        BeginningValue > 0 && EndingValue > 0 && NumberOfYears > 0,
        (EndingValue / BeginningValue) ^ (1 / NumberOfYears) - 1,
        BLANK()
    )
