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

Dax Column - Copy Date from a defined column and IF blank... copy date from another defined column

Hi all, 

 

My first time posting and I'm new to PBI, so apologies if this is a little unorganized.

 

Below is a snapshot of my data table. 

 

The outcome I am looking for is to show in the "Date of Activity Logged - Copy" Column the "Date of Status Change" date for this row and IF this is blank... to show the "Date of Activity Logged" date for the same row within the "Date of Activity Logged - Copy" also.

 

MattSh0tt0n_0-1670948820165.png

 

Unfortunately the source of this dataset splits these two dates into different cells, when the preferred outcome is that only the most recent date of the two is shown in a column... if that is a different way to view the issue? 

 

Any help on this is appreciated. 

 

Many thanks

Matt

 

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Try going back into PowerQuery and instead of duplicating the column, use a formula to add a new column.

= Table.AddColumn(Custom1, "NewColumnName", each if [Date of Status Change] = "" then [Date of Activity Logged] else [Date of Activity Logged])

I'm not sure where the most recent of the two dates fits in, but you can use List.Max({[Date of Status Change]}&{[Date of Activity Logged]}) to adjust the formula above if I missed something.

View solution in original post

1 REPLY 1
vicky_
Super User
Super User

Try going back into PowerQuery and instead of duplicating the column, use a formula to add a new column.

= Table.AddColumn(Custom1, "NewColumnName", each if [Date of Status Change] = "" then [Date of Activity Logged] else [Date of Activity Logged])

I'm not sure where the most recent of the two dates fits in, but you can use List.Max({[Date of Status Change]}&{[Date of Activity Logged]}) to adjust the formula above if I missed something.

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.

Top Solution Authors