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! Learn more

Reply
jmpmolegraaf
Frequent Visitor

conditional lastnonblank

Hello all,

 

I have below measure / visual table:
I only want to show values when CostCategory = "ADD"
the filling down by lastnonblank needs to keep on working (obviously).
no matter where I try to filter, I never get a value for "ADD" only at every date.

jmpmolegraaf_0-1739275712141.png
thanks for your help!!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jmpmolegraaf , hello rajendraongole1, thank you for your prompt reply!

 

Try the following measure:

lastnonblank = 
IF(
    MAX(UpstreamMargins[CostCategory]) = "Add",
    CALCULATE(
        LASTNONBLANK(
            UpstreamMargins[AppDate],
            SUM(UpstreamMargins[UM (USD/HL)])
        ),
        _Calendar[Date] <= MAX(_Calendar[Date])
    ),
"")

Result:

vyajiewanmsft_0-1739351144359.png

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @jmpmolegraaf , hello rajendraongole1, thank you for your prompt reply!

 

Try the following measure:

lastnonblank = 
IF(
    MAX(UpstreamMargins[CostCategory]) = "Add",
    CALCULATE(
        LASTNONBLANK(
            UpstreamMargins[AppDate],
            SUM(UpstreamMargins[UM (USD/HL)])
        ),
        _Calendar[Date] <= MAX(_Calendar[Date])
    ),
"")

Result:

vyajiewanmsft_0-1739351144359.png

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

rajendraongole1
Super User
Super User

Hi @jmpmolegraaf  - can you create a measure using LASTNONBLANK only considers rows where CostCategory = "ADD"

LastNonBlankADD =
VAR LastDate =
CALCULATE(
MAX( 'Table'[Date] ),
'Table'[CostCategory] = "ADD"
)
RETURN
CALCULATE(
MAX( 'Table'[Date] ),
'Table'[Date] = LastDate,
'Table'[CostCategory] = "ADD"
)

 

If the measure still doesn't work as expected, let me know how it's behaving and also share pbix file by removing sensitive data.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





will test, much appreciated 🙂
just curious, you do not use lastnonblank -- why? 

@jmpmolegraaf -Good question! The reason I didn't use LASTNONBLANK in my first response is that the issue you're facing is more about filtering while maintaining the fill-down behavior, rather than just retrieving the last non-blank value.

 

Hope it works. please check 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





unfortunately I can't get it to work...

jmpmolegraaf_0-1739278527342.png

 

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