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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors