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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
kasiaw29
Resolver II
Resolver II

Expressions that yield variant data-type error message in if statement

Hi community, 

 

I'm tryingto create a custom column that checks some dates and returns "LATE" if it meets criteria or a date otherwise. 

My formula goes as follows:

Actual Start =

IF(ISBLANK(RELATED('Sub Project w Activities'[Actual Start]))
&& 'Activity History'[Latest Customer Agreed Dispatch Date]<=TODAY(),"LATE",RELATED('Sub Project w Activities'[Actual Start]))

 

In simple terms, if actual start is blank and latest customer agreed dispatch date is before today then it's late (refers to activity), if however actual start is there I just want to show it. I've looked through form and previous issues indicate using FORMAT but I don't see where to use it, all my dates? 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@kasiaw29 , One place you are returning "Late" another place date. Power BI dax Do not allow different data types

 

Try like

Actual Start =

IF(ISBLANK(RELATED('Sub Project w Activities'[Actual Start]))
&& 'Activity History'[Latest Customer Agreed Dispatch Date]<=TODAY(),"LATE",RELATED('Sub Project w Activities'[Actual Start])&"")

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@kasiaw29 , One place you are returning "Late" another place date. Power BI dax Do not allow different data types

 

Try like

Actual Start =

IF(ISBLANK(RELATED('Sub Project w Activities'[Actual Start]))
&& 'Activity History'[Latest Customer Agreed Dispatch Date]<=TODAY(),"LATE",RELATED('Sub Project w Activities'[Actual Start])&"")

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak I've also placed FORMAT in my resultiffalse 

IF(ISBLANK(RELATED('Sub Project w Activities'[Actual Start])) && 'Activity History'[Latest Customer Agreed Dispatch Date]<=TODAY(),"LATE",FORMAT(RELATED('Sub Project w Activities'[Actual Start]),""))
 
Which simingly does the same thing. Thank you so much for your fast reply! 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors