cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ddeutschman
Helper I
Helper I

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
lndnbrg
Resolver III
Resolver III

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]&"-")

View solution in original post

1 REPLY 1
lndnbrg
Resolver III
Resolver III

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]&"-")

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!