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
rmod32345
Frequent Visitor

Return Last Non Blank Measure for All Dates in Table

Hello,

 

I have a date table connected to a fact table which only evaluates a measure on a monthly basis. I'd like to see the last non blank value of that measure returned for every date that I add to a table visual.

 

rmod32345_0-1729527924456.png

 

So for example, I'd like to be able to return 1.068M for 8/10, 8/17, 8/24 and then 1.059M for 9/7, 9/14 and so forth. Any ideas on how I'd achieve this?

 

Thanks

 

1 ACCEPTED SOLUTION
v-kongfanf-msft
Community Support
Community Support

Hi @rmod32345 ,

 

You can try formula like below to create measure:

LastNonBlankMeasure = 
VAR LastNonBlankDate =
    CALCULATE (
        MAX ( 'DateTable'[Date] ),
        FILTER (
            ALL ( 'DateTable' ),
            'DateTable'[Date] <= MAX ( 'DateTable'[Date] )
                && NOT ( ISBLANK ( [total_] ) )
        )
    )
RETURN
    CALCULATE (
        [total_],
        FILTER ( ALL ( 'DateTable' ), 'DateTable'[Date] = LastNonBlankDate )
    )

vkongfanfmsft_0-1729671338904.png

 

Best Regards,
Adamk Kong

 

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

3 REPLIES 3
v-kongfanf-msft
Community Support
Community Support

Hi @rmod32345 ,

 

You can try formula like below to create measure:

LastNonBlankMeasure = 
VAR LastNonBlankDate =
    CALCULATE (
        MAX ( 'DateTable'[Date] ),
        FILTER (
            ALL ( 'DateTable' ),
            'DateTable'[Date] <= MAX ( 'DateTable'[Date] )
                && NOT ( ISBLANK ( [total_] ) )
        )
    )
RETURN
    CALCULATE (
        [total_],
        FILTER ( ALL ( 'DateTable' ), 'DateTable'[Date] = LastNonBlankDate )
    )

vkongfanfmsft_0-1729671338904.png

 

Best Regards,
Adamk Kong

 

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

Tahreem24
Super User
Super User

@rmod32345 Try this DAX

NewColumn =
VAR LastNonBlankDate =
    CALCULATE (
        LASTNONBLANK ( 'Table'[Date], 1 ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Date] <= EARLIER ('Table'[Date] )
                && NOT ( ISBLANK ( 'Table'[Sales] ) )
        )
    )
RETURN
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] = LastNonBlankDate )
    )
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Would something similar be possible in a measure?

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.