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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.