Forum Discussion

MarcUrdang's avatar
MarcUrdang
Post Patron
6 years ago
Solved

Variance and variance %

Please advise on how to create a variance and a variance % as per below:

I have created two calculations which compute a measure for a period of time. This year to date and last year to date:

 

1. This YTD:   CALCULATE(SUM('Table1'[measures]),DATESYTD((Date'])))

2. Last YTD:   CALCULATE(SUM('Table1'[measures]),DATEADD(FILTER(DATESYTD('Table1'[Date]),'Table1'[Date]<TODAY()),-1,YEAR))

 

I have a table whih show various cities and the above two calcs show the values per city.

For example if CityA had 10 for last YTD and 15 for this YTD then the Variance must show 5 and the % difference would be 50%

 

Thank you

Marc

8 Replies

  • Variance = [This YTD] - [Last YTD]

     

    Variance % = DIVIDE ( ([This YTD] - [Last YTD]), [Last YTD], 0)

     

    - SV

    • MarcUrdang's avatar
      MarcUrdang
      Post Patron

      Thank you so much for the reply .. on the variance amount (this year - last year) .. the value doesn't reflect correctly. The variance amount is the same as the actual amount.. it shows as follows:

       

      Country        2019     var          2020    var

      Spain            100      100          150     150

       

      it shoud show

       

      Country        2019     var          2020    var

      Spain            100      0             150      50

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Variance = [This YTD] - [Last YTD]

    Variance% = ([This YTD] - [Last YTD]) / [Last YTD]

     

    • MarcUrdang's avatar
      MarcUrdang
      Post Patron

      Hi Greg .. I see you already posted back on this ... I originally tried this .... but get the same number for each as the example shows below:

       

      hank you so much for the reply .. on the variance amount (this year - last year) .. the value doesn't reflect correctly. The variance amount is the same as the actual amount.. it shows as follows:

       

      Country        2019     var          2020    var

      Spain            100      100          150     150

       

      it shoud show

       

      Country        2019     var          2020    var

      Spain            100      0             150      50