Forum Discussion

Draginko's avatar
Draginko
Helper I
2 years ago
Solved

Inflation value based on selection on parameter table

Hello,   I need to get the value of projected salary affected by inflation rate based on the selection user selected with slicer where is a numeric range parameter table, showing how far in the fut...
  • Draginko's avatar
    2 years ago

    Okay, after some time I have figure it out, and this measure is working fine just in case somebody would be interested into it:

    Projected Salary = 
    VAR __SelectedYears = SELECTEDVALUE('Years of Inflation'[Years of Inflation])
    VAR __SelectedCountry = SELECTEDVALUE('output'[Country])
    VAR __SelectedRole = SELECTEDVALUE('output'[Role])
    
    VAR __vInflationRates = 
        FILTER(
            ALL('InflationForecast'),
            'InflationForecast'[Country] = __SelectedCountry && 
            'InflationForecast'[Year] > YEAR(TODAY()) && 
            'InflationForecast'[Year] <= YEAR(TODAY()) + __SelectedYears
        )
    VAR __BaseSalary = 
        CALCULATE(
            SUM('output'[TCOW per FTE]),
            'output'[Role] = __SelectedRole
        )
    
    VAR ProjectedSalary = 
        __BaseSalary * PRODUCTX(
            __vInflationRates,
            1 + 'InflationForecast'[Rate]
        )
        
    VAR __Result =
        IF(
            __SelectedYears = 0,
            __BaseSalary,
            IF(
                ISBLANK(__SelectedYears) || ISBLANK(__SelectedCountry) || ISBLANK(__SelectedRole),
                BLANK(),
                ProjectedSalary
            )
        )
    
    RETURN
        __Result