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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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