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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Find the biggest value in a table with conditions

Hi,

 

I need to find a solution to find the most recent date for all the lines who have the same ID.

Here is an exemple:

In the exemple below, I'm searching for a formula that will search in the column ID and Version all the lines with the same ID and the same version, then return "OK" for the one with the most recent date. 

 

ID1VersionDateSolution I want
123  v122/03/2020  KO
123  v123/09/2020  OK
123  v120/05/2020  KO
G0  v112/12/2020  OK
G0  v201/01/2020  KO
AV  v119/11/2020  KO
AV  v120/11/2020  OK
G0  v105/05/2020

  KO

123  v102/02/2020

  KO

123  v216/04/2020

  KO

123  v217/04/2020

  OK

G0  v224/09/2020

  OK

 

I hope that it is clear.

Thank you for your help !

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please try the below.

 

Picture4.png

 

 

newest =
VAR newest =
CALCULATE ( MAX ( Data[Date] ), ALLEXCEPT ( Data, Data[ID1], Data[Version] ) )
RETURN
IF ( MAX ( Data[Date] ) = newest, "OK", "KO" )

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please try the below.

 

Picture4.png

 

 

newest =
VAR newest =
CALCULATE ( MAX ( Data[Date] ), ALLEXCEPT ( Data, Data[ID1], Data[Version] ) )
RETURN
IF ( MAX ( Data[Date] ) = newest, "OK", "KO" )

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Linkedin: https://www.linkedin.com/in/jihwankim1975/

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Thank you Jihwan. It didn't work at the beginning but when I deleted the max() in your last line, it worked ! Thank you for your help ! 

DataZoe
Employee
Employee

@Anonymous you could try this measure:

 

Solution =
VAR MaxDate =
CALCULATE ( MAX ( 'Table'[Date] ), REMOVEFILTERS ( 'Table'[Date] ) )
RETURN
IF ( SELECTEDVALUE ( 'Table'[Date] ) = MaxDate, "OK", "KO" )

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Anonymous
Not applicable

Hi DataZoe,

 

Thank you for you help but it didn't work. It doesn't filter the colums ID and versions to find the most recent dates with the same ID/versions

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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