Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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.
Solved! Go to Solution.
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 @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.
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
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 46 | |
| 35 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 88 | |
| 76 | |
| 41 | |
| 26 | |
| 26 |