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
adavid999
Helper V
Helper V

Dax measure to select date for latest/max value

Hello, 

 

how do I write a measure to select the date alongside the latest/max value?

 

Based on below, I would like my measure to display as "07/02/2022" as 1.68 is the latest/max value.

 

dateindexvalue
31/01/202200
07/02/202211.68
14/02/20222null
21/02/20223null
28/02/20224null
07/03/20225null
14/03/20226null
21/03/20227null
28/03/20228null
04/04/20229null
11/04/202210null
18/04/202211null
25/04/202212null
02/05/202213null

Thanks

A

2 ACCEPTED SOLUTIONS
freginier
Solution Specialist
Solution Specialist

Create a measure or column with this

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

View solution in original post

adavid999
Helper V
Helper V

Thanks @freginier though this doesn't work for me on table below. Do you know why?

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

 

 

Column1Column2
31/01/20220
07/02/20221.68
14/02/2022null
21/02/2022null
28/02/2022null
07/03/2022null
14/03/2022null
21/03/2022null
28/03/2022null
04/04/2022null
11/04/2022null
18/04/2022null
25/04/2022null
02/05/2022null

View solution in original post

7 REPLIES 7
adavid999
Helper V
Helper V

Thanks @freginier though this doesn't work for me on table below. Do you know why?

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

 

 

Column1Column2
31/01/20220
07/02/20221.68
14/02/2022null
21/02/2022null
28/02/2022null
07/03/2022null
14/03/2022null
21/03/2022null
28/03/2022null
04/04/2022null
11/04/2022null
18/04/2022null
25/04/2022null
02/05/2022null

Can you send me a power bi sample with this 2 columns ? 

sorry, this did work. I neglected to name the measure when I copied your code

my measure = var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

 

Good. Enjoy 🙂

Don't forget to add kudo and accept the solution 😉 

Hi @freginier I'm not authorised to upload pbix files but it's basically something like this:

adavid999_0-1643624498424.png

 

See this Pbi file 

https://we.tl/t-CODQTtLNVK 

freginier
Solution Specialist
Solution Specialist

Create a measure or column with this

var MaxValue = MAX( 'Table'[Column2] )
return 
LOOKUPVALUE('Table'[Column1],'Table'[Column2],MaxValue)

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.