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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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