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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
VitorXavierCell
Regular Visitor

How to get a value of the last date?

Hello, 

 

I have a database that has the following colunms: Product, Date and value. I need to get the value of the last date per product, to put in a card. How can I do this?

 

Best regards!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

v-yinliw-msft
Community Support
Community Support

Hi @VitorXavierCell ,

 

You can try the following methods.

 

Here is my test table:

vyinliwmsft_0-1663225184740.png

 

 

Measure:

Max date =

CALCULATE (

    MAX ( 'Product'[Date] ),

    FILTER ( 'Product', [Product] = SELECTEDVALUE ( 'Product'[Product] ) )

)
Max date value =

CALCULATE (

    MAX ( 'Product'[Value] ),

    FILTER (

        'Product',

        [Date] = [Max date]

            && [Product] = SELECTEDVALUE ( 'Product'[Product] )

    )

)

 

The result is:

vyinliwmsft_1-1663225184750.png

 

 

Is this the result you expect?

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yinliw-msft
Community Support
Community Support

Hi @VitorXavierCell ,

 

You can try the following methods.

 

Here is my test table:

vyinliwmsft_0-1663225184740.png

 

 

Measure:

Max date =

CALCULATE (

    MAX ( 'Product'[Date] ),

    FILTER ( 'Product', [Product] = SELECTEDVALUE ( 'Product'[Product] ) )

)
Max date value =

CALCULATE (

    MAX ( 'Product'[Value] ),

    FILTER (

        'Product',

        [Date] = [Max date]

            && [Product] = SELECTEDVALUE ( 'Product'[Product] )

    )

)

 

The result is:

vyinliwmsft_1-1663225184750.png

 

 

Is this the result you expect?

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Why is this accepted as solution when SELECTEDVALUE would only work when there's exactly one value selected for a given dimension? There could easily me more than one or none Product(s) selected at all...

VitorXavierCell
Regular Visitor

Thank you @amitchandak for the answer. I'll try those articles.

 

amitchandak
Super User
Super User

@VitorXavierCell , Refer my these two blogs


https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

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

Why can't we just use LASTNONBLANK/LASTNONBLANKVALUE here?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.