Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Complicated Calculation (Please Help)

Hi Everyone,   Please help me on this - is this possible to be done?    Scenario 1:  when the business transformation filter to single activity (activity 1) :    impact on workload: -60% impa...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Based on your description, you can create a measure as follows.

    Test_measure =
    VAR x0 =
        SELECTEDVALUE ( ACT[Activity] )
    VAR x1 =
        SWITCH (
            TRUE (),
            MAX ( 'Test_activity'[Year] ) <= 2021, MAX ( 'Test_activity'[units] ),
            MAX ( 'Test_activity'[units] ) * 0.4
        )
    VAR x2 =
        SWITCH (
            TRUE (),
            MAX ( 'Test_activity'[Year] ) <= 2021, MAX ( 'Test_activity'[units] ),
            MAX ( 'Test_activity'[Year] ) >= 2025,
                MAX ( 'Test_activity'[units] ) * 0.4 * 0.8,
            MAX ( 'Test_activity'[units] ) * 0.4
        )
    RETURN
        IF (
            ISFILTERED ( ACT[Activity] ),
            IF (
                x0 = "activity 1",
                x1,
                IF (
                    x0 = "activity 2",
                    BLANK (),
                    IF (
                        COUNTROWS ( ALLSELECTED ( ACT[Activity] ) ) = DISTINCTCOUNT ( ACT[Activity] ),
                        x2,
                        BLANK ()
                    )
                )
            ),
            BLANK ()
        )
    

    Result:

    Hope that's what you were looking for.

    Best Regards,

    Yuna

     

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