Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
norbi
Helper I
Helper I

Measure to calculate Monthly Growth

Hi,

 

This is my first post and am very new to DAX functions. What I would like to achieve is to sum the prior months data and the current months data to calculate the percentage growth on the totals. The table however only illustrates the numbers for different items and needs to be SUM up then calculated. Below you will find a example table:

periodbilled
01 January 20161
01 January 20161
01 January 20161
01 January 20161
01 January 20161
01 February 20161
01 February 20161
01 February 20161
01 February 20161
01 February 20161
01 February 20161
01 March 20161
01 March 20161
01 March 20161
01 March 20161
01 March 20161
01 March 20161
01 March 20161
01 April 20161
01 April 20161
01 April 20161
01 May 20161
01 May 20161
01 May 20161
01 May 20161
01 June 20161
01 June 20161

 

Desired result:

Jan5 
Feb620.00%
Mar716.67%
Apr3-57.14%
May433.33%
Jun2-50.00%

 

I have tried the following without success:

test_2 = (CALCULATE(SUM('test.txt'[billed]), PREVIOUSMONTH('test.txt'[period])) - sum('test.txt'[billed])) /CALCULATE(SUM('test.txt'[billed]), PREVIOUSMONTH('test.txt'[period]))

 

 

6 REPLIES 6
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @norbi and welcome to the community

 

Please give this calculated measure a crack.  Then add it to a Grid along with your two columns

 

Measure = 
Var PrevMonth = CALCULATE(SUM('Table'[billed]),PARALLELPERIOD('Table'[period],-1,MONTH))
Var ThisMonth = CALCULATE(SUM('Table'[billed]))
return DIVIDE((ThisMonth - PrevMonth),PrevMonth)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thank you @Phil_Seamark I have tried the formula however it looks like the calculation is only on the total:

Capture.JPG

 

I would like to achieve the measure for every month on month percentage.

 

Hi @norbi

 

I double checked and it definitely works for me.

 

Please make sure your Period column is set to the DATE datatype, and your Billed is a numeric datatype. I also format the Measure as a percentage.

 

period.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@norbi

Note that Phil uses a Date while you use a Date Hierarchy,

If you want to use a Hierarchy build a Calendar Table

A generic can be easily built by clicking New Table and typing Calendar Table = CALENDARAUTO( )

then relate the 2 date columns and use the Calendar Table [Date] in the Table/Matrix

then you can also write therse simple Measures to do the same

Total Billed = SUM ( 'Table'[billed] )

Total Bill PM = CALCULATE ( SUM ( 'Table'[billed] ), PREVIOUSMONTH ( 'Calendar Table'[Date] ) )

% Change = DIVIDE ( [Total Billed] - [Total Bill PM], [Total Bill PM], 0 )

MoM Change = [Total Billed] - [Total Bill PM]

And the result...

% Change MoM.png

Hope this helps! Smiley Happy

 

EDIT: You can still use the Measure from above but reference the Calendar date again

Measure =
VAR PrevMonth =
    CALCULATE (
        SUM ( 'Table'[billed] ),
        PARALLELPERIOD ( 'Calendar Table'[Date], -1, MONTH )
    )
VAR ThisMonth =
    CALCULATE ( SUM ( 'Table'[billed] ) )
RETURN
    DIVIDE ( ( ThisMonth - PrevMonth ), PrevMonth )

% Change MoM2.png 

@Seanand @Phil_Seamark,thank you very much for the definition of these Measures. They will most probably work, I am however still struggling with my date format and getting this corrected. For the Calendar Table I get the following error: The optional argument of CALENDARAUTO function must evaluate to a constant value.

Hi @norbi,

 

Could you please provide you formula that use CALENDARAUTO function? This function returns a table with a single column named “Date” that contains a contiguous set of dates. The range of dates is calculated automatically based on data in the model.
https://msdn.microsoft.com/en-us/library/dn802534.aspx

 

Regards,

Charlie Liao

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.