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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Return value of column

Hi, I am new to Powerbi and I am finding it difficult to fine a DAX formula that works for what I want to do.

 

If column Y has a date in the column ignore column X, if column Z has a date in the column ignore column Y. If there is no date in column Zand Y return column X. Thank you for your help in advance 

 

Column X Column Y  Column Z 
22/01/2021 25/03/2021

 

28/08/2021

     
     
1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

In DAX it would be something like this:

_myDate =
SWITCH(
  TRUE(),
  NOT ISBLANK(yourTable[Column Z]), yourTable[Column Z],
  NOT ISBLANK(yourTable[Column Y]), yourTable[Column Y],
  yourTable[Column X]
)

 

In Power Query, you could do something like this:

List.Last(ListRemoveNulls({[Column X], [Column Y], [Column Z]}))

 

There's more than one way to achieve this in either DAX or Power Query though.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

In DAX it would be something like this:

_myDate =
SWITCH(
  TRUE(),
  NOT ISBLANK(yourTable[Column Z]), yourTable[Column Z],
  NOT ISBLANK(yourTable[Column Y]), yourTable[Column Y],
  yourTable[Column X]
)

 

In Power Query, you could do something like this:

List.Last(ListRemoveNulls({[Column X], [Column Y], [Column Z]}))

 

There's more than one way to achieve this in either DAX or Power Query though.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

It worked! thank you so much 🙂 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors