Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
derickyy
Frequent Visitor

Group Two Columns with Two Different Logic

Hi,

 

Can you please help me with the following table manipulation? It would be best if it can be achieved through power query but dax query is also acceptable.

 

Basically, I have one table with persons' names and their starte_date and end_date values. I want to group the start_date and end_date values by their persons' names but when doing the grouping, I need the MIN value from start_date and MAX value from end_date so as to get a date range. Please refer to the tables below:

 

Raw data:

PersonStart DateEnd Date
AMarch-1-2021July-1-2021
AJan-1-2021March-1-2021
AAug-1-2020Dec-1-2020
BJuly-1-2021Dec-1-2021
BJune-1-2021July-1-2021
CMarch-1-2021August-1-2021
CJan-1-2021March-1-2021
CJune-1-2020August-1-2020
CJan-1-2020June-1-2020

 

Output:

PersonStart DateEnd Date
AAug-1-2020July-1-2021
BJune-1-2021Dec-1-2021
CJan-1-2020August-1-2021

 

Please let me know if anyone has any thoughts on this. Thanks in advance!

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Use the 'Group By' in Power Query.

You can add 2 aggregations by selecting the 'Advanced' radio button.

So 'Group By' the Person and add the 2 aggregations.

I'll help if you get stuck

View solution in original post

2 REPLIES 2
derickyy
Frequent Visitor

Thanks, this is exactly what I looking for!

HotChilli
Super User
Super User

Use the 'Group By' in Power Query.

You can add 2 aggregations by selecting the 'Advanced' radio button.

So 'Group By' the Person and add the 2 aggregations.

I'll help if you get stuck

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.