cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ddeutschman Regular Visitor
Regular Visitor

Use of the Len operation in an If statement

I am attempting to create a custom column with the following formula:

 

Job = If(Len('UMC Safety Incident Log'[Project Number]=4),"0"&'UMC Safety Incident Log'[Project Number]&"-", 'UMC Safety Incident Log'[Project Number]&"-")

 

I get the error "DAX comparison operations do not support comparing values of the type Text with values of type integer.  Consider using the VALUE or FORMAT function to convert one of the values."

 

Len is supposed to return a Whole Number.  Why is this throwing an error?  How is it supposed to be formatted? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
lndnbrg Member
Member

Re: Use of the Len operation in an If statement

Try this:
Job = If(Len('UMC Safety Incident Log'[Project Number])=4,"0"&'UMC Safety Incident Log'[Project Number]&"-", 'UMC Safety Incident Log'[Project Number]&"-")
1 REPLY 1
Highlighted
lndnbrg Member
Member

Re: Use of the Len operation in an If statement

Try this:
Job = If(Len('UMC Safety Incident Log'[Project Number])=4,"0"&'UMC Safety Incident Log'[Project Number]&"-", 'UMC Safety Incident Log'[Project Number]&"-")