Forum Discussion

sarjensystems1's avatar
sarjensystems1
Helper III
6 years ago
Solved

dynamic last year value

Hii   I Have a requirement to display last year june month sales value for all the months data ex june 2019 sales is 1000 then values for Jan 2020,feb 2020,mar 2020.....Dec 2020 should be 1000 j...
  • v-kelly-msft's avatar
    6 years ago

    Hi  sarjensystems1 ,

     

    Take the following steps:

     

    1.Create a slicer table with all the years which equal to the table year +1,as you see below:

    2.Create 2 calculated columns using below dax expressions to get the year and month from the table date:

     

    Column = YEAR('Table'[Date])
    Column 2 = MONTH('Table'[Date])

     

    3.Create a measure to get the sales in June of last year.

     

    Measure = CALCULATE(SUM('Table'[Consumption]),FILTER('Table','Table'[Column]=SELECTEDVALUE(Slicer[Year])-1&&'Table'[Column 2]=6))

     

    And you will see:

    For the related .pbix file,pls click here.

     
    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!