cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mediviz
New Member

select the last value saved by item

Hi everyone

Below I have a table with dates and scores by name.

 

NomDateScore
AAA01.01.2021  1540
AAA02.01.2021   1640
AAA03.01.2021   1753
AAA04.01.2021        1840
AAA05.01.2021    1940
AAA06.01.2021   2040
AAA07.01.2021870
BBB01.01.2021875
BBB02.01.2021698
BBB03.01.2021566
BBB04.01.2021641
BBB05.01.2021255
CCC01.01.2021120
CCC02.01.2021218
CCC03.01.202155

 

I need to display only the last score recorded by name.

 

NomDateScore
AAA07.01.2021    870
BBB05.01.2021    255
CCC03.01.2021   55


Thanks for your help

2 ACCEPTED SOLUTIONS
ERD
Super User
Super User

Hi @Mediviz ,

You can try this measure:

 

MaxValuePerNom = 
VAR currNom = SELECTEDVALUE ( T[Nom] )
VAR maxDate = MAXX ( FILTER ( ALL ( T ), T[Nom] = currNom ), T[Date] )
RETURN
    IF (
        SELECTEDVALUE ( T[Date] ) = maxDate,
        CALCULATE ( MAX ( T[Score] ), T[Nom] = currNom, Table15[Date] = maxDate )
    )

ERD_0-1624947316305.png

 

 

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

Icey
Community Support
Community Support

Hi @Mediviz ,

 

Try this:

Measure filter =
VAR LastDate_ =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Nom] ) )
RETURN
    IF ( MAX ( 'Table'[Date] ) = LastDate_, 1 )

measure filter.PNG

 

 

Best Regards,

Icey

 

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

3 REPLIES 3
Icey
Community Support
Community Support

Hi @Mediviz ,

 

Try this:

Measure filter =
VAR LastDate_ =
    CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Nom] ) )
RETURN
    IF ( MAX ( 'Table'[Date] ) = LastDate_, 1 )

measure filter.PNG

 

 

Best Regards,

Icey

 

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

ERD
Super User
Super User

Hi @Mediviz ,

You can try this measure:

 

MaxValuePerNom = 
VAR currNom = SELECTEDVALUE ( T[Nom] )
VAR maxDate = MAXX ( FILTER ( ALL ( T ), T[Nom] = currNom ), T[Date] )
RETURN
    IF (
        SELECTEDVALUE ( T[Date] ) = maxDate,
        CALCULATE ( MAX ( T[Score] ), T[Nom] = currNom, Table15[Date] = maxDate )
    )

ERD_0-1624947316305.png

 

 

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

amitchandak
Super User
Super User

@Mediviz , Try a measure like


Measure =
VAR __id = MAX ('Table'[Nom] )
VAR __date = CALCULATE ( max('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[Nom] = __id )
CALCULATE ( Sum ('Table'[Score] ), VALUES ('Table'[Nom] ),'Table'[Nom] = __id,'Table'[Date] = __date )

 

if need take amx for dat

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors