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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Lanabanana
Regular Visitor

Calculating month-over-month while excluding blanks

Hi everyone,

I'm looking to exclude blank cells from a measure I've created.
I've got a formula where I'm calculating the month over month over a 15 year period for 27 products.
However, some of my products are introduced in the middle of the 15 year period. When I put them all in a visual, the products that start in the middle show -100% for all of the previous months.
The visual calculates the bottom N products and it always takes these products with the -100%
I've tried doing a simple filter that excludes the -100% but then when I filter for years that are prior to the middle of the period, the visual shows as empty.

Here are my measures:
PREV_MONTH = CALCULATE(SUM('Product '[VALUE]),DATEADD('Product'[Reference Period],-1,MONTH))

 Month over month = CALCULATE((DIVIDE(SUM('Product'[VALUE]),[PREV_MONTH])-1))


How do I insert a bit to exclude the calculating of blank values?

Thank you!
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Lanabanana 

Give this a try

Month over month =
VAR CurrMonth =
    SUM ( 'Product'[VALUE] )
RETURN
    IF ( NOT ISBLANK ( CurrMonth ), DIVIDE ( CurrMonth, [PREV_MONTH] ) - 1 )

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

Hello @Lanabanana 

Give this a try

Month over month =
VAR CurrMonth =
    SUM ( 'Product'[VALUE] )
RETURN
    IF ( NOT ISBLANK ( CurrMonth ), DIVIDE ( CurrMonth, [PREV_MONTH] ) - 1 )

Hey ,

This formula has worked for the most part.
But when I look at the first month that the product is introduced, it still shows -100% and I can't include my visual with the largest decreases for that month.
Is there a workaround to this?


EDIT: I replaced Currmonth with [PREV_MONTH] in the brackets after NOT ISBLANK and no more -100% for the first month. All fixed!

Thanks!

That did the trick! Amazing - thank you 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.