Forum Discussion

Jorgast's avatar
Jorgast
Resolver II
8 years ago
Solved

Previous Month Compare

Hi Everyone,

 

I have the month and the "count of the month" but what i am trying to do, is find the difference and the % change against the previous month.

 

I created the data in Excel so you get a picture of what i am trying to do.

  • The % Change is ((Month/previous month)-1)
  • "Count of Month" is a measure.

 

 

MonthCount of MonthDifference% Change
Jan-1739224  
Feb-17565801735644%
Mar-17763021972235%
Apr-171480727177094%
May-17367138219066148%
Jun-17155014-212124-58%
Jul-172276027258847%
Aug-1780799-146803-64%
Sep-17275734194935241%
Oct-17202661-73073-27%
Nov-17134777-67884-33%
Dec-1714188471075%

 

Thanks in advance

  • Hi Jorgast,

     

    You can try these measures:

     

    _Previous Month = CALCULATE(SUM(Table1[Count of Month]); PREVIOUSMONTH(DIM_DATA[Date]))

    _Diff = SUM(Table1[Count of Month]) - [_Previous Month]

    _% Change = IF(ISBLANK(DIVIDE(SUM(Table1[Count of Month]);  [_Previous Month]; 0)) = TRUE(); BLANK();  DIVIDE(SUM(Table1[Count of Month]);  [_Previous Month]; 0) - 1)

     

    Be aware it's important to have a date dimension in order to use time intelligence functions.

     

    Thanks,

     

    Ricardo

  • Jorgast's avatar
    Jorgast
    8 years ago

    ricardocamargos

     

    How would that work if the count of month is measure?

    MEASURE:  Count of Month = COUNT(Table[Month])

    COLUMN:   Month = Format(Table[Month], "MMM - YYYY"

9 Replies

  • ricardocamargos's avatar
    ricardocamargos
    Continued Contributor

    Hi Jorgast,

     

    You can try these measures:

     

    _Previous Month = CALCULATE(SUM(Table1[Count of Month]); PREVIOUSMONTH(DIM_DATA[Date]))

    _Diff = SUM(Table1[Count of Month]) - [_Previous Month]

    _% Change = IF(ISBLANK(DIVIDE(SUM(Table1[Count of Month]);  [_Previous Month]; 0)) = TRUE(); BLANK();  DIVIDE(SUM(Table1[Count of Month]);  [_Previous Month]; 0) - 1)

     

    Be aware it's important to have a date dimension in order to use time intelligence functions.

     

    Thanks,

     

    Ricardo

    • Jorgast's avatar
      Jorgast
      Resolver II

      ricardocamargos

       

      How would that work if the count of month is measure?

      MEASURE:  Count of Month = COUNT(Table[Month])

      COLUMN:   Month = Format(Table[Month], "MMM - YYYY"

  • Hi, I have something similar. I want to show difference between this two table on a month with graphics preview. In this case I want to show the difrerence for each parameters graphically (visual). Can you help me ?
    • Jorgast's avatar
      Jorgast
      Resolver II

      ricardocamargos

       

      Ricardo had the right idea. In your case you just want to show the difference between 2 tables, so you would stop at step #2

      _Previous Month = CALCULATE(SUM(Table1[Count of Month]); PREVIOUSMONTH(DIM_DATA[Date]))

      _Diff = SUM(Table1[Count of Month]) - [_Previous Month]

      _% Change = IF(ISBLANK(DIVIDE(SUM(Table1[Count of Month]);  [_Previous Month]; 0)) = TRUE(); BLANK();  DIVIDE(SUM(Table1[Count of Month]);  [_Previous Month]; 0) - 1)

      • toni14's avatar
        toni14
        Helper I

        Hi Jorgast,

         

        Thank you for your help. I tried this but doesn't work. It shows me that DIM_DATA cannot be found. I will send you some screenshots.