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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
schaezac
Frequent Visitor

Show latest value based on date and other criteria (measure or new column)

Hi,

 

I am trying to create a measure or column that will allow me to easily bring the latest value into my visuals. Here is some example data; the highlighted column is what I'm trying to create.

 

schaezac_0-1741725149350.png

 

The end goal is to show the most recent sale as a flat line across a graph, so I can compare historical sales to the most recent one visually, by product. Also, the date needs to be dynamic so it automatically updates the values when fresh data is loaded.

 

Thanks!

1 ACCEPTED SOLUTION
techies
Super User
Super User

Hi @schaezac please check this

 

MostRecentSalePerProduct =
VAR LatestDateForProduct =
    CALCULATE(
        MAX('Sheet2'[Date]),
        ALLEXCEPT('Sheet2', 'Sheet2'[Product])
    )
RETURN
CALCULATE(
    MAX('Sheet2'[Sale]),
    ALLEXCEPT('Sheet2', 'Sheet2'[Product]),
    'Sheet2'[Date] = LatestDateForProduct
)
Power BI & Microsoft Fabric
PL-300 | DP-600 | DP-700 Certified

View solution in original post

2 REPLIES 2
techies
Super User
Super User

Hi @schaezac please check this

 

MostRecentSalePerProduct =
VAR LatestDateForProduct =
    CALCULATE(
        MAX('Sheet2'[Date]),
        ALLEXCEPT('Sheet2', 'Sheet2'[Product])
    )
RETURN
CALCULATE(
    MAX('Sheet2'[Sale]),
    ALLEXCEPT('Sheet2', 'Sheet2'[Product]),
    'Sheet2'[Date] = LatestDateForProduct
)
Power BI & Microsoft Fabric
PL-300 | DP-600 | DP-700 Certified

EDIT: please disregard follow up - fixed my date table range to correct this. Thanks again, you're a lifesaver!

 

This worked - thanks so much! One last question - is there a way to curtail the data so it does not extend past my most recent data? For example, in the graph below, my most recent data is in January 2025. I would like the dotted line (the one you helped me create) to stop in January as well. I think this is due to my date table extending far beyond the latest actual data.

 

schaezac_0-1741784668711.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.