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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
megg8
New Member

IF date is blank, pull date from different table

i have 2 tables with target closure dates. 

 

I'm trying to write a DAX/formula IF statement that will go "if [tableA] target closure date is blank, populate with [tableB] target closure date, else [tableA] target closure date. 

I tried the below, but kept getting "Expressions that yield variant data-type cannot be used to define calculated columns."

true target close date = IF(ISBLANK('TableA'[Target Closure Date]), CALCULATE(MAX(TableB[Target Closure Date])), 'TableA'[Target Closure Date])
 
Not sure what to do
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @megg8 ,

 

If it's a date field, then just change it from text type to date type and then try the formula as above to see if it works?

vkongfanfmsft_0-1715329237435.png

 

Best Regards,
Adamk Kong

 

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
Anonymous
Not applicable

Thanks for the reply from @vicky_ , please allow me to provide another insight:

 

Hi  @megg8 ,

 

You can try formula like below and create calculated column in tableA:

 

True Target Close Date =
IF (
    ISBLANK ( 'TableA'[Target Closure Date] ),
    MAXX ( 'TableB', 'TableB'[Target Closure Date] ),
    'TableA'[Target Closure Date]
)

 

vkongfanfmsft_1-1715134875905.png

vkongfanfmsft_0-1715134857369.png

 

Best Regards,
Adamk Kong

 

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

 

vicky_
Super User
Super User

Is the data type the same? i.e both Table A closure date and Table B closure date are actually date type (and one of them isn't a number / string)... Otherwise, the issue might be that your column name starts with True, which might be a reserved word (i don't know for sure, because i can't find the docs for this)

that was the problem, one of my dates had a data type of text. 

Anonymous
Not applicable

Hi @megg8 ,

 

If it's a date field, then just change it from text type to date type and then try the formula as above to see if it works?

vkongfanfmsft_0-1715329237435.png

 

Best Regards,
Adamk Kong

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.