Forum Discussion

powerbiexpert22's avatar
powerbiexpert22
Impactful Individual
2 years ago
Solved

rolling count

i am trying to create line chart to show the rolling count of promoters for last 3 months by yearmonth, it is giving me same results for all yearmonth in table 

 

pbix

https://drive.google.com/file/d/1-3eT8k82RvTSem4EbzZJ_OlUU-A_PiMo/view?usp=drive_link

 

 

 

promotersrolling2 =

calculate(
    survey2[Promoters],
'Date'[Date]>=EDATE(TODAY(),-3)

&&
'Date'[Date]<=TODAY()
)

 

 

 

 

  • Hi powerbiexpert22 can you try below measure 

     

    PromotersRolling3Months =
    VAR CurrentYearMonth = MAX('Date'[YearMonth])
    RETURN
    CALCULATE(
        [Promoters],
        DATESINPERIOD(
            'Date'[Date],
            MAX('Date'[Date]),
            -3,
            MONTH
        )
    )

     

    Hope it works

     

1 Reply

  • Hi powerbiexpert22 can you try below measure 

     

    PromotersRolling3Months =
    VAR CurrentYearMonth = MAX('Date'[YearMonth])
    RETURN
    CALCULATE(
        [Promoters],
        DATESINPERIOD(
            'Date'[Date],
            MAX('Date'[Date]),
            -3,
            MONTH
        )
    )

     

    Hope it works