Forum Discussion

STIBBS_807's avatar
STIBBS_807
Resolver I
4 years ago
Solved

Simple Growth Measure

I have the following data that I would like to do a growth % for:

 

Year     Totals  Case Type      Year End

20171420Intake31/12/2017
20181520Intake31/12/2018
20191358Intake31/12/2019
20201079Intake31/12/2020
2021802Intake31/12/2021
2017557Investigation31/12/2017
2018473Investigation31/12/2018
2019421Investigation31/12/2019
2020410Investigation31/12/2020
2021336Investigation31/12/2021
2017233Ongoing31/12/2017
2018186Ongoing31/12/2018
2019154Ongoing31/12/2019
2020145Ongoing31/12/2020
2021122Ongoing31/12/2021

 

Measure 1  is:

Prev Year= CALCULATE(SUM('TABLE NAME'[Totals]),SAMEPERIODLASTYEAR('TABLE NAME'[Year End]))

 

Measure 2 is:

%Growth =CALCULATE(DIVIDE(SUM('TABLE NAME'[Totals])- [Prev Year],[Prev Year])*1)

 

I am not getting my Prev Year value in the column.  I get an over all total of 1151 and zero growth.😫

 

Here is the results that I would like to get:😀

YearTotalsPrev Year%Growth
20172210  
201821792210-1%
201919332179-11%
202016341933-15%
202112601634-23%

 

Please review my measures and tell me what I am missing.  Thank you.

 

Alternatively I would like to see this:

Case TypeYearTotalsPrev YearGrowth%
Intake20171420  
Intake2018152014207%
Intake201913581520-11%
Intake202010791358-21%
Intake20218021079-26%
Investigation2017557  
Investigation2018473557-15%
Investigation2019421473-11%
Investigation2020410421-3%
Investigation2021336410-18%
Ongoing2017233  
Ongoing2018186233-20%
Ongoing2019154186-17%
Ongoing2020145154-6%
Ongoing2021122145-16%

I have Filters on my page so I can use that to get the Case Types if this is not achievable. 

  • STIBBS_807  Do you have a DimDate table? https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

    Time Intelligence is MUCH easier with a date table. 

     

    Follow the instructions in my blog if you don't have one, then try these measures: 

     

    Total Value = SUM('TABLE NAME'[Totals])

    PY Total Value = CALCULATE ( [Total Value] , DATEADD( DimDate[Date], -1, YEAR) )

    % Growth Totals = DIVIDE( [Total Value] - [PY Total Value], [PY Total Value] )

     

    Make sure you use that % Growth within the context of a Year or date slicer/visual.

5 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    STIBBS_807  Do you have a DimDate table? https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

    Time Intelligence is MUCH easier with a date table. 

     

    Follow the instructions in my blog if you don't have one, then try these measures: 

     

    Total Value = SUM('TABLE NAME'[Totals])

    PY Total Value = CALCULATE ( [Total Value] , DATEADD( DimDate[Date], -1, YEAR) )

    % Growth Totals = DIVIDE( [Total Value] - [PY Total Value], [PY Total Value] )

     

    Make sure you use that % Growth within the context of a Year or date slicer/visual.

  • Thank you.  I do have a DimDate table set up.   I will try your solution and let you know if it works for me.

  • Almost there.  Now I have the totals but the Previous Year do not line up correctly.

     

    Total IIO = SUM('Table Name'[Totals])
    PY IIO = CALCULATE([Total IIO],DATEADD('Calendar'[Date],-1,YEAR))
    IIO %Growth = CALCULATE( divide(([Total IIO] -[PY IIO]),[PY IIO]))

     My Calendar table is set up like so:

    So I am not sure What I have done wrong in the Matrix.  Do I have my Calendar Table set up incorrectly?

  • Found my Problem.  The calendar table that I imported was not defined as a Date Table.  Once I did that all when well.  Thank you for your assistance and patience.

    • AllisonKennedy's avatar
      AllisonKennedy
      Community Champion

      STIBBS_807 Glad you got it working - that mark as date table is a hidden trick that catches a lot of people. I struggled with it for ages when I started learning Power BI and couldn't figure out why my calculations weren't working!