cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RMD
Frequent Visitor

How to find latest date value in a group

 Hello Experts,

 

I am trying to extract only the latest date record row from a table with multiple dates per group.  

For example:  from this table i need only the record row of 1/1/2017 12:00 am of HMY 12.223 and 12.224

 

So each HMY code can have multiple dates  > I need only the latest date record

 

Thanks for you help!

 

Example1.PNG

 

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi AMD,

First, create a measure to see the lasted date of each kind HMY code as following formula:

Measure 2 =
CALCULATE ( MAX ( 'Table1'[date] )ALLEXCEPT ( Table1, Table1[HMY] ) )

Next, create another measure to judge whether the date of every HMY code equals the lasted date of each kind HMY code, this is to say whether the value of ‘date’ column equals ‘Measure 2’ column’s :

Measure 3 = IF ( MAX ( Table1[date] ) = [Measure 2], 1, 0 )

 

Then, you will see them showing in the Report view:

 9.png

 

Finally, on the Visual level filters, select the value of second measure which is equal to 1,and after applying this filter, we will see as follows.

10.png

12.png

 

If you have any question, please feel free to ask.

Best regards,
Maggie Li

 

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi AMD,

First, create a measure to see the lasted date of each kind HMY code as following formula:

Measure 2 =
CALCULATE ( MAX ( 'Table1'[date] )ALLEXCEPT ( Table1, Table1[HMY] ) )

Next, create another measure to judge whether the date of every HMY code equals the lasted date of each kind HMY code, this is to say whether the value of ‘date’ column equals ‘Measure 2’ column’s :

Measure 3 = IF ( MAX ( Table1[date] ) = [Measure 2], 1, 0 )

 

Then, you will see them showing in the Report view:

 9.png

 

Finally, on the Visual level filters, select the value of second measure which is equal to 1,and after applying this filter, we will see as follows.

10.png

12.png

 

If you have any question, please feel free to ask.

Best regards,
Maggie Li

 

View solution in original post

@v-juanli-msft is there a way to do this using calculated columns?

I want to pivot the data I have afterwards, so I assume I would need calculated columns instead of measures.

Specifically, I want to do the following:

image.png

Manny thanks Maggie for you help 🙂

Helpful resources

Announcements
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!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors