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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
peerasit_ary
Frequent Visitor

I would like to find Price as of date range (Only last record id)

I would like to find Price as of date range (Only last record id (RECID) if found multiple record in that date range)

Group by S_UNIT

 

2021-02-03 18_02_13-Window.png

 

I try DAX below

 

Price = 
    VAR ASOF = LASTDATE(DimDate[Date])

    RETURN
        CALCULATE(
            SUM(fPriceTable[UNITPRICE]),
            FILTER(fPriceTable,                
                fPriceTable[RECID] =
                    CALCULATE(
                        MAX(fPriceTable[RECID]),
                        FILTER(fPriceTable, 
                            fPriceTable[FROMDATE] <= ASOF
                            && fPriceTable[TODATE] >= ASOF
                        )
                    )
            )         
        )

 

 

The green result is ok

How can i get Price in red result = 0 and correct the Total line

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@peerasit_ary , Try a measure like

Last = calculate(max(Table[Unit Price]), filter(Table, Table[to_date] = calculate(max(Table[Project_Step]), allexcept(Table, Table[S Unit]))) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@peerasit_ary , Try a measure like

Last = calculate(max(Table[Unit Price]), filter(Table, Table[to_date] = calculate(max(Table[Project_Step]), allexcept(Table, Table[S Unit]))) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.