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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Add1
Frequent Visitor

Repeat the most recent data point and corresponding month.

I community. I need a bit of guidance. I have this dataset within the screenshot. I need to create a dynamic way to pull the most recent Preventative Maintenance numbers and the corresponding month when updated data is provided. In the screenshot, is what I want my final result to be... repeating Oct:343, until someone actually updates the table.
 
Below is the code that I created so far.
 
Any assistance would be great!
 
Thank you
Add1_0-1685469734229.png

 

 
 
 
3 Test = VAR LatestPMValue =
    VAR MaxSortOrder = MAX('Facilities - Test'[Sort Order])
    VAR Index = 1
    VAR LatestPMValue2Measure2 = lookupvalue('Facilities - Test'[Preventative Maintenance],'Facilities - Test'[PMIndex],max('Facilities - Test'[PMIndex]))                         VAR PrevMaintenance =
        LOOKUPVALUE(
            'Facilities - Test'[Preventative Maintenance],
            'Facilities - Test'[Sort Order],
            MaxSortOrder - Index
        )
    VAR Month =
        LOOKUPVALUE(
            'Facilities - Test'[Month],
            'Facilities - Test'[Sort Order],
            MaxSortOrder - Index
        )
    VAR Result =
        IF(
            ISNUMBER(PrevMaintenance),
            LEFT(Month, 3) & ": " & PrevMaintenance,
            BLANK()
        )
    RETURN
        Result

RETURN
    LatestPMValue
1 ACCEPTED SOLUTION
Add1
Frequent Visitor

I found the solution. I created a calculated table that pulled in the sort order, month, and preventative maintenance. I also added a column that produces the needed result. Then I created a DAX measure used the lookupvalue function to pull the last data point.

View solution in original post

1 REPLY 1
Add1
Frequent Visitor

I found the solution. I created a calculated table that pulled in the sort order, month, and preventative maintenance. I also added a column that produces the needed result. Then I created a DAX measure used the lookupvalue function to pull the last data point.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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.