Forum Discussion

Sdhn420's avatar
Sdhn420
Icon for Helper IV rankHelper IV
5 years ago
Solved

Previous Year - December

How can i get sales for previous year December only? 

I have a table with sales and date.

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Sdhn420 ,

     

    You can create a measure as follows.

    _sum = SUMX(FILTER(ALL('Table'),YEAR([Date])=YEAR(TODAY())-1&&MONTH([Date])=12),[Sales])

    My test table:

    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.

     

2 Replies

  • Sdhn420 , Try like, with help from date table

     

    last year last MTD Sales =
    var _max = datediff(startofyear('Date'[Date],"12/31"), maxx(allselected('Date'), 'Date'[Date]),month)
    return
    CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1*_max,MONTH)))

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Sdhn420 ,

     

    You can create a measure as follows.

    _sum = SUMX(FILTER(ALL('Table'),YEAR([Date])=YEAR(TODAY())-1&&MONTH([Date])=12),[Sales])

    My test table:

    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.