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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
santoshlearner2
Resolver II
Resolver II

growth % over month on month

Dear All,

I have a measure for growth % over previous month, but when i want to display this in a graph / Matrix over month on month.

I have the following measure

Current Stock: Calculate(sum(stock, month)

Previous Stock: CALCULATE( current stock,PREVIOUSMONTH(month)

Growth% = DIVIDE( ( current stock-  previous stock), previous stock)


When i put in the card visual it is perfect, but in matrix if i do, i get infinity error/

Slicer selections: year / then user has option to select Months.

 

Pls advise what wrong i am doing.

3 ACCEPTED SOLUTIONS
mdaatifraza5556
Super User
Super User

Hi @santoshlearner2 

Could you please try the below dax to create a measure ?

Please ensure that your date table is marked as date table.

Growth % =
VAR CurrentStock = [Current Stock]
VAR PreviousStock =
CALCULATE(
[Current Stock],
PREVIOUSMONTH('Date'[Date]) 
)
RETURN
IF(
ISBLANK(PreviousStock) || PreviousStock = 0,
BLANK(),
DIVIDE(CurrentStock - PreviousStock, PreviousStock)
)

 

If this answer your questions, kindly accept it as a solution and give kudos.

View solution in original post

Hi @santoshlearner2 ,

Infinity/blank in MoM usually comes from dividing by zero (or by a blank previous value) when there is no data for the previous month in the current filter context. The fix is to calculate the previous month stock robustly and guard the division.

 

Recommended approach (works well with year slicer and month drill-down)

Create a MoM growth measure that uses a separate PreviousMonth calculation and returns blank (or 0) when there is no previous value.


Growth % MoM = VAR CurrentStock = [Current Stock]

VAR PreviousStock = CALCULATE([Current Stock], PREVIOUSMONTH('Date'[Date])) RETURN IF(ISBLANK(PreviousStock) || PreviousStock = 0, BLANK(), DIVIDE(CurrentStock - PreviousStock, PreviousStock) )

 

Notes:

[Current Stock] should be a stable measure (e.g., CALCULATE(SUM(Stock), ...)) that respects the visual’s date context.
'Date'[Date] must come from a proper Date table marked as a Date table, with a relationship to your fact table on the date/key field.


PREVIOUSMONTH will work within the current visual context; if there’s no data for the previous month in the current filter, PreviousStock will be blank.


If you prefer to handle cross-year smoothly (sometimes PREVIOUSMONTH yields blanks when your slicers exclude the previous month), you can use DATEADD instead:

Growth % MoM (DATEADD) = VAR CurrentStock = [Current Stock] VAR PreviousStock = CALCULATE([Current Stock], DATEADD('Date'[Date], -1, MONTH)) RETURN IF(ISBLANK(PreviousStock) || PreviousStock = 0, BLANK(), DIVIDE(CurrentStock - PreviousStock, PreviousStock) )

 

Please mark this post as solution if it hepls you. Appreciate Kudos.

View solution in original post

Ensure your date table is properly marked as a Date Table and use a continuous date column. Then try 

 

Growth % MOM =
VAR CurrentStock = [Current Stock]
VAR PreviousStock =
CALCULATE(
[Current Stock],
DATEADD('Date'[Date], -1, MONTH)
)
RETURN
IF(
ISBLANK(PreviousStock) || PreviousStock = 0,
BLANK(),
DIVIDE(CurrentStock - PreviousStock, PreviousStock)
)

 

View solution in original post

4 REPLIES 4
mdaatifraza5556
Super User
Super User

Hi @santoshlearner2 

Could you please try the below dax to create a measure ?

Please ensure that your date table is marked as date table.

Growth % =
VAR CurrentStock = [Current Stock]
VAR PreviousStock =
CALCULATE(
[Current Stock],
PREVIOUSMONTH('Date'[Date]) 
)
RETURN
IF(
ISBLANK(PreviousStock) || PreviousStock = 0,
BLANK(),
DIVIDE(CurrentStock - PreviousStock, PreviousStock)
)

 

If this answer your questions, kindly accept it as a solution and give kudos.

Hi


getting blank error, 

 

Thanks

Ensure your date table is properly marked as a Date Table and use a continuous date column. Then try 

 

Growth % MOM =
VAR CurrentStock = [Current Stock]
VAR PreviousStock =
CALCULATE(
[Current Stock],
DATEADD('Date'[Date], -1, MONTH)
)
RETURN
IF(
ISBLANK(PreviousStock) || PreviousStock = 0,
BLANK(),
DIVIDE(CurrentStock - PreviousStock, PreviousStock)
)

 

Hi @santoshlearner2 ,

Infinity/blank in MoM usually comes from dividing by zero (or by a blank previous value) when there is no data for the previous month in the current filter context. The fix is to calculate the previous month stock robustly and guard the division.

 

Recommended approach (works well with year slicer and month drill-down)

Create a MoM growth measure that uses a separate PreviousMonth calculation and returns blank (or 0) when there is no previous value.


Growth % MoM = VAR CurrentStock = [Current Stock]

VAR PreviousStock = CALCULATE([Current Stock], PREVIOUSMONTH('Date'[Date])) RETURN IF(ISBLANK(PreviousStock) || PreviousStock = 0, BLANK(), DIVIDE(CurrentStock - PreviousStock, PreviousStock) )

 

Notes:

[Current Stock] should be a stable measure (e.g., CALCULATE(SUM(Stock), ...)) that respects the visual’s date context.
'Date'[Date] must come from a proper Date table marked as a Date table, with a relationship to your fact table on the date/key field.


PREVIOUSMONTH will work within the current visual context; if there’s no data for the previous month in the current filter, PreviousStock will be blank.


If you prefer to handle cross-year smoothly (sometimes PREVIOUSMONTH yields blanks when your slicers exclude the previous month), you can use DATEADD instead:

Growth % MoM (DATEADD) = VAR CurrentStock = [Current Stock] VAR PreviousStock = CALCULATE([Current Stock], DATEADD('Date'[Date], -1, MONTH)) RETURN IF(ISBLANK(PreviousStock) || PreviousStock = 0, BLANK(), DIVIDE(CurrentStock - PreviousStock, PreviousStock) )

 

Please mark this post as solution if it hepls you. Appreciate Kudos.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.