Forum Discussion

Narender's avatar
Narender
Icon for Resolver I rankResolver I
8 years ago
Solved

Last 2 year amount

Hi All,

 

I want a sum(amount) of last 2 year.Means sum(amount) group by last 2 year.

 

Like i want last 2 year sum.

 

 

 

Year   amount

 

2017   100$

2018   200$

-----------------

TOTAL  300$

 

Thanks

 

 

Narender

 

  • Hi Narender,

     

    Try to use [Date] instead of [Enter_Date], please.

     

    Best Regards,

    Dale

19 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Narender,

     

    We can get the total in the "Total" row of the visual with the formula below. What's your issue?

    Sales = sum('table'[Amount])

     

    Best Regards,

    Dale

    • Narender's avatar
      Narender
      Icon for Resolver I rankResolver I

      Hi Dale, 

      your expression will show the total amount. if i apply year in dimention in chart then it will show year wise amount.

       

      I have year starting from 2000 to 2018 . So I want only last 2 year amount.

       

      Means 2017 & 2018 amount only.

       

       

      Year     Amount

      2017    10$

      2018    20$

      Total    30$

       

       

      So when 2019 will come then

      It will show data for 2018 & 2019 only.

       

      Thanks,

       

      Narender

      • pawel1's avatar
        pawel1
        Icon for Kudo Kingpin rankKudo Kingpin

        what about the DATESINPERIOD function?

         

        last 2 years of sales =
        CALCULATE([Total Sales],
            DATESINPERIOD('Date'[Date], MAX('Date'[Date]),-2,YEAR))