Forum Discussion

Paulo123's avatar
Paulo123
Frequent Visitor
4 years ago
Solved

Running Total lastyear

hi, I wanted the measure to return the accumulated value of the last year. but when I filter for example the year 2021, it should return the accumulated value for the year 2020 but it returns blank. The measure:
LY_V_LI_ACUM =
CALCULATE (SUMX (VALUES(Dados[Mês]),[LY_VL]),
FILTER ( ALLSELECTED ( Dados), Dados[Data Valor] <= MAX(CALENDARIO[Date])
))
  • Hi,

    I recommend creating a normal RT calculation like: 
    RT =

    CALCULATE (SUM (Dados[Mês])
    ALLSELECTED ( Dados), Dados[Data Valor] <= MAX(CALENDARIO[Date])
    )

    Then create LY measure like this:
    [RT LY] = 
    CALCULATE([RT],SAMEPERIODLASTYEAR(CALENDARIO[Date]))

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
  • Hi Paulo123 ,

     

    Sorry, It's hard to give an accurate formula without detail information. SAMEPERIODLASTYEAR  works well in my model. Please refer to this pbix

     

     

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

4 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    I recommend creating a normal RT calculation like: 
    RT =

    CALCULATE (SUM (Dados[Mês])
    ALLSELECTED ( Dados), Dados[Data Valor] <= MAX(CALENDARIO[Date])
    )

    Then create LY measure like this:
    [RT LY] = 
    CALCULATE([RT],SAMEPERIODLASTYEAR(CALENDARIO[Date]))

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi Paulo123 ,

     

    Sorry, It's hard to give an accurate formula without detail information. SAMEPERIODLASTYEAR  works well in my model. Please refer to this pbix

     

     

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