cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Calculate the 'Latest Modified By' based on 'Latest Change Date'

Hi guys,

I have the feeling this is simple, yet I can't figure it out.

So, I have this table CHANGES (simplified, lol):

 

Opportunity IDChange DateModified By
101-Feb-2020John
115-Feb-2020Adam

 

I need:

- the latest Change Date per Opportunity ID;

- who did it (so, 'Modified By' column).

 

I got, via this measure, the latest Change Date.

The Latest Change Date =

MAXX(
    KEEPFILTERS(VALUES('CHANGES'[Opportunity ID])),
    CALCULATE(MAX('CHANGES'[Change Date]))
)
 
However, I miss (in a column or a measure), the Modified By name.
 
Could you help me out, please?
 
Thank you,
 
Alice
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

@AliceW ,

For date you can take max(Table[Date])

and for modified by

Modified By Name = 
VAR __id = MAX ( 'Table'[Opportunity ID] )
VAR __Change Date = CALCULATE ( MAX( 'Table'[Change Date] ), ALLSELECTED ( 'Table' ),  'Table'[Opportunity ID] = __id ) 
RETURN CALCULATE ( MAX ( 'Table'[Modified By] ), VALUES ( 'Table'[Opportunity ID] ), 'Table'[Opportunity ID] = __id, 'Table'[Change Date] = __Change Date )

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

7 REPLIES 7
Highlighted
Super User IV
Super User IV

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

@AliceW ,

For date you can take max(Table[Date])

and for modified by

Modified By Name = 
VAR __id = MAX ( 'Table'[Opportunity ID] )
VAR __Change Date = CALCULATE ( MAX( 'Table'[Change Date] ), ALLSELECTED ( 'Table' ),  'Table'[Opportunity ID] = __id ) 
RETURN CALCULATE ( MAX ( 'Table'[Modified By] ), VALUES ( 'Table'[Opportunity ID] ), 'Table'[Opportunity ID] = __id, 'Table'[Change Date] = __Change Date )

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

Hi @AliceW ,

 

You can create these 2 measures:

 

Max_Date = CALCULATE(MAX('Table'[Change Date]); ALLEXCEPT('Table'; 'Table'[Opportunity ID]))
 
Modified By LD = CALCULATE(DISTINCT('Table'[Modified By]); FILTER(ALLEXCEPT('Table';'Table'[Opportunity ID]); 'Table'[Change Date] = [Max_Date]))
 
Ricardo

Did I answer your question? Mark my post as a solution!
Ricardo

Highlighted
Post Patron
Post Patron

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

Hi Camargos,

First of all, thank you for replying! The first formula is great, but I get an error for the second: 'a table of multiple values was supplied where a single value was expected'.

Do you know what happened?

Thank yoU!

Ioana

Highlighted
Post Patron
Post Patron

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

Thank you so much, @amitchandak !! It worked!!!

Highlighted
Post Patron
Post Patron

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

@amitchandakone follow-up question, if I may. I'd like to have this beautiful measure as a column in another table, which has one Opportunity ID per line.

This way, I can use it in visuals as Axis. Super important! Thank you so much.

Highlighted
Community Champion
Community Champion

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

Hi @AliceW ,

 

It usually happens when you have all set combined set more than 1x, once DISTINCT function hopes only 1 return, if you have more than it, you get an error like u got.

 

Ricardo


Did I answer your question? Mark my post as a solution!
Ricardo

Highlighted
Super User IV
Super User IV

Re: Calculate the 'Latest Modified By' based on 'Latest Change Date'

Hi,

I blogged about my solution to a very question yesterday - Show text entries in the value area section of a Pivot Table after meeting certain conditions.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors