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

Create Max Date Columns based on multiple columns (some with blanks)

Hello, 

I am trying to create a column populated with the max date from a series of columns.  Some of the columns have blanks in them.  For example Notification "1" would have a date of 9/16/2022 and Notification "2" would have a date of 4/25/2022.

 

Notification          01                    02                  03                   04                   05                   21

1                    4/14/2022       4/27/2022                                9/16/2022

2                    4/16/2022                              4/25/2022         4/25/2022

3                    4/16/2022                                                                             12/31/2022

4                    4/14/2022

 

Thank you!

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

Hi  @BA11501Banderso ,

Here are the steps you can follow:

1. Enter PowerQuery and copy the Table to form Table2.

vyangliumsft_0-1668057094729.png

2. Select all columns in Table2 except [Notification] - Transform - Unpivot Columns.

vyangliumsft_1-1668057094739.png

Result:

vyangliumsft_2-1668057094741.png

3. Create calculated column.

Table2:

max_date =
 MAXX(FILTER(ALL('Table2'),'Table2'[Notification]=EARLIER('Table2'[Notification])),[Value])

Table:

Max Date Columns =
MINX(FILTER(ALL('Table2'),'Table2'[Notification]=EARLIER('Table'[Notification])),[max_date])

4. Result:

vyangliumsft_3-1668057094743.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @BA11501Banderso ,

Here are the steps you can follow:

1. Enter PowerQuery and copy the Table to form Table2.

vyangliumsft_0-1668057094729.png

2. Select all columns in Table2 except [Notification] - Transform - Unpivot Columns.

vyangliumsft_1-1668057094739.png

Result:

vyangliumsft_2-1668057094741.png

3. Create calculated column.

Table2:

max_date =
 MAXX(FILTER(ALL('Table2'),'Table2'[Notification]=EARLIER('Table2'[Notification])),[Value])

Table:

Max Date Columns =
MINX(FILTER(ALL('Table2'),'Table2'[Notification]=EARLIER('Table'[Notification])),[max_date])

4. Result:

vyangliumsft_3-1668057094743.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thank you Liu!  You made it very easy to follow.

FreemanZ
Super User
Super User

DAX works on columns, so you would need to transpose your data and add a column with MAX function for each Notification.  

Greg_Deckler
Super User
Super User

@BA11501Banderso Might be best to unpivot your columns, or you can use this: Multi-Column Aggregations (MC Aggregations) - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.