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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jameskeuning
Frequent Visitor

Why does the DAX formula for a very simple LEFT using FIND notwork like it works in every other app?

I have this formula that works fine:

(find(",",'Enforcement%20Tracking'[Matter Name + Details],1,blank())-1)

 

It finds the position of the first comma and then subtracts one

 

And I have this formula that works fine:

left('Enforcement%20Tracking'[Matter Name + Details],12)
 
It returns the left 12 characters.
 
But when I replace the "12" in the second formula with the working formula that finds that actual number of chacters I need, it does not work: "An argument of function LEFT has the wrong data type or has an invalild value.
 
I created a column with the working "find" formula in it and called it Pos. And then I tried:
 
left('Enforcement%20Tracking'[Matter Name + Details],[Pos])
 
And it does not work either
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @jameskeuning ,

 

LEFT expects a numeric value, FIND returns BLANK (what is a not a numeric value) if you change the NOTFOUNDPARAMETER to a reasonable value it works as expected.

If you can not provide a reasonable value, then you have to check the return value of FIND and depending on the result you branch to the LEFT algorithm or something different like another BLANK()

DAX does not perfrom implicit type conversion, some people consider this great some don't.

 

Hopefully, this provedes you ideas of how to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey @jameskeuning ,

 

LEFT expects a numeric value, FIND returns BLANK (what is a not a numeric value) if you change the NOTFOUNDPARAMETER to a reasonable value it works as expected.

If you can not provide a reasonable value, then you have to check the return value of FIND and depending on the result you branch to the LEFT algorithm or something different like another BLANK()

DAX does not perfrom implicit type conversion, some people consider this great some don't.

 

Hopefully, this provedes you ideas of how to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thanks Tom. I noticed that I get a -1 result if there is no comma in the field, so that gave me a hint as to the problem, and your response helped me connect the dots.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors