Forum Discussion

immkhan's avatar
immkhan
Frequent Visitor
6 years ago
Solved

How to calculate Growth based on multiple dimension

Hi   I want to calculate Growth for Current year (Month over Month), Growth over last year and Five Year Growth. The dimension to calculate growth is multiple. 1) Company , Country, Customer, Prod...
  • v-alq-msft's avatar
    6 years ago

    Hi, immkhan 

     

    Based on your description, I created data to reproduce your scenario.

     

    Test:

     

    Calendar:

     

    Calendar = CALENDARAUTO()

     

     

    There is a one-to-one relationship between two 'Calendar' and 'Table'.

     

    You may create a measure as below.

     

    PeriodValue = 
    var _period = SELECTEDVALUE(Test[Period])
    return
    IF(
        _period = "Current year",
        CALCULATE(
            SUM('Table'[Value]),
            DATESYTD('Calendar'[Date])
        ),
        IF(
            _period = "Last year",
            CALCULATE(
                SUM('Table'[Value]),
                DATESYTD(SAMEPERIODLASTYEAR('Calendar'[Date]))
            ),
            IF(
                _period = "Last five years",
                CALCULATE(
                    SUM('Table'[Value]),
                    DATESINPERIOD(
                        'Calendar'[Date],
                        LASTDATE('Calendar'[Date]),
                        -5,
                        YEAR
                    )
                )
            )
        )
    )

     

     

     

     

    You may also use other dimensions as slicers to filter the result. Here are the results.

     

     

     

    Best Regards

    Allan

     

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