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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Aron_Moore
Solution Specialist
Solution Specialist

DAX Help - Compare to nonexistent row

Hello experts,

 

Trying to build a model that compares inventory levels period to period. Trouble is, when the level goes from 0 (or blank) to X, it doesn't calculate that as an increase. Tried the +0 trick but doesn't seem to work either. How can I do this?

 

Current measure:

Delta QTY = CALCULATE(SUM('Monthly SLoc Value'[Total Q])+0,FILTER('Monthly SLoc Value','Monthly SLoc Value'[Date]=MAX('Calendar'[Date])))
            -CALCULATE(SUM('Monthly SLoc Value'[Total Q])+0,FILTER('Monthly SLoc Value','Monthly SLoc Value'[Date]=MIN('Monthly SLoc Value'[Date])))

 

Results for two different materials. The second which has values each period works, but the first didn't exist period one and thus fails.

Capture.PNG

 

Thanks!

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Aron_Moore,

 

Could you try the formula below to see if it works in your scenario? Smiley Happy

Delta QTY =
CALCULATE (
    SUM ( 'Monthly SLoc Value'[Total Q] ) + 0,
    FILTER (
        'Monthly SLoc Value',
        'Monthly SLoc Value'[Date] = MAX ( 'Calendar'[Date] )
    )
)
    - CALCULATE (
        SUM ( 'Monthly SLoc Value'[Total Q] ) + 0,
        FILTER (
            'Monthly SLoc Value',
            'Monthly SLoc Value'[Date] = MIN ( 'Calendar'[Date] )
        )
    )

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Aron_Moore,

 

Could you try the formula below to see if it works in your scenario? Smiley Happy

Delta QTY =
CALCULATE (
    SUM ( 'Monthly SLoc Value'[Total Q] ) + 0,
    FILTER (
        'Monthly SLoc Value',
        'Monthly SLoc Value'[Date] = MAX ( 'Calendar'[Date] )
    )
)
    - CALCULATE (
        SUM ( 'Monthly SLoc Value'[Total Q] ) + 0,
        FILTER (
            'Monthly SLoc Value',
            'Monthly SLoc Value'[Date] = MIN ( 'Calendar'[Date] )
        )
    )

 

Regards

Ah, good catch. That did it.

 

Thanks!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors