cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors