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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.