Forum Discussion

J_Mug's avatar
J_Mug
Icon for Helper I rankHelper I
6 years ago
Solved

Dynamic Month Over Month with filters

Hi,    I wanted to know if it's possible to have a dynamic calculation of MoM/YoY % to change with date filters. Right now I have this measure and it returns correctly the current month change vs t...
  • v-yingjl's avatar
    6 years ago

    Hi J_Mug ,

    I don't know the structure of your dataset but the logic of the measure should work fine. Have you tested the measure in your report?

    Or you can modify the measure like this but I'm not certain:

    Response MoM% =
    VAR _BASELINE_VALUE =
        CALCULATE (
            COUNT ( NPS[Ratings] ),
            DATESMTD ( DATEADD ( Calendary[Date], -1, MONTH ) )
        )
    VAR _VALUE_TO_COMPARE =
        TOTALMTD ( COUNT ( NPS[Ratings] ), ALLSELECTED ( Calendary[Date] ) )
    RETURN
        IF (
            _VALUE_TO_COMPARE > _BASELINE_VALUE,
            ABS ( DIVIDE ( _VALUE_TO_COMPARE - _BASELINE_VALUE, _BASELINE_VALUE, 0 ) ),
            - ABS ( DIVIDE ( _VALUE_TO_COMPARE - _BASELINE_VALUE, _BASELINE_VALUE, 0 ) )
        )

    If the above not help, could you please share a sample file for further discussion? Sample data and expected output would help tremendously.
    Please see this post regarding How to Get Your Question Answered Quickly:
    https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

     

    Best Regards,
    Yingjie Li

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