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
VictorWentz
Frequent Visitor

SUMMARIZE BY TWO COLUMN THAN BRING OTHER RELATED VALUES TO THE ROWS

Hello, first of all, happy new year! 

 

I need help with a problem that I can't solve. I am trying to summarize the data by two columns, and get the maximum date, but I want to bring the value from the status column referring to this maximum date.

 

Here is an example:

 

My data:

Person training  validationDate  Status 
p1nr1031/08/2022red
p1nr1001/09/2022blue
p2nr1219/09/2022green
p2nr1031/08/2022red
p3nr1120/09/2022red
p4nr1021/09/2022green
p1nr1002/09/2022green
p2nr1231/12/2022green
p3nr1112/03/2022blue
p2nr1201/01/2023blue

 

With

 

 

 

SUMMARIZE(myData, myData[Person], myData[training], "maxDate", MAX(myData[validationDate]))

 

 

 

 

I get:

 Person  training  maxDate 
p1nr1002/09/2022
p2nr1031/08/2022
p2nr1201/01/2023
p3nr1120/09/2022
p4nr1021/09/2022

 

So far so good. but what's the next step? 

The result I desire is:

 Person  training   maxDate Status 
p1nr1002/09/2022 green
p2nr1031/08/2022 red
p2nr1201/01/2023 blue
p3nr1120/09/2022 red
p4nr1021/09/2022 green

 

I tried the following code:

 

 

SUMMARIZE(myData, myData[Person], myData[training], "maxDate", MAX(myData[validationDate]), "Status", SELECTEDVALUE(myData[Status]))

 

 

 

but the code just get the status where the summarize has a single value. I think it's a way to get the status value ordering by date, and getting the last value but I got nowhere.

 

Thanks for your time in helping me. Have a nice day!

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

You can try...

SUMMARIZE(
    myData,
    myData[Person],
    myData[training],
    "maxDate", MAX(myData[validationDate]),
    "status", LOOKUPVALUE(myData[Status], myData[Person], [Person], myData[training], [training], myData[validationDate], MAX(myData[validationDate]))
)

 




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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
jgeddes
Super User
Super User

You can try...

SUMMARIZE(
    myData,
    myData[Person],
    myData[training],
    "maxDate", MAX(myData[validationDate]),
    "status", LOOKUPVALUE(myData[Status], myData[Person], [Person], myData[training], [training], myData[validationDate], MAX(myData[validationDate]))
)

 




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

Proud to be a Super User!





Hi @jgeddes ,

 

It worked!

 

Thanks for your help, I really appreciate it 🙂 

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.