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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
fashpixie
New Member

LEN Function Not Working with Subtraction

Email = RIGHT(RE_Usage_Data[User],LEN(RE_Usage_Data[User])-3)&"@xyz.com"

Hello!

 

When I entered the function above into the Data view in Power BI, I receive an error stating "An Argument of function 'RIGHT' has the wrong data type or has an invalid view."

 

In piecing the formula apart, it looks like the "-3" is causing the issue.  With this formula, I'm trying to do the following:

 

  • Take a column of text formatted like this: ar/john.b.smith

          and return the following:

 

  • john.b.smith@xyz.com

 

The RE_Usage_Data[User] field is formatted as text - I'm thinking Power BI is not liking that I'm subtracting 3 from the ar/john.b.smith text.  However, based on how this formula is structured, it should be taking the LEN value of 15 and subtracting 3.  12 should be in the RIGHT formula as the number of characters, and no errors should be returned.  I'm also able to replicate this formula in Excel with no issues - it's also worked in other Power BI files.  

 

Is there anything I can adjust in my formula or any other workarounds to get rid of this error?

 

Thanks for the help! 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The issue is you have a value with 3 or less characters somewhere in your list.  Try this formula instead.

 

Email = Var Length = LEN(RE_Usage_Data[User])
RETURN
IF(
    Length <= 3,
    "",
    right([Name], Length - 3) & "@xyz.com"
)

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

The issue is you have a value with 3 or less characters somewhere in your list.  Try this formula instead.

 

Email = Var Length = LEN(RE_Usage_Data[User])
RETURN
IF(
    Length <= 3,
    "",
    right([Name], Length - 3) & "@xyz.com"
)

Thank you for the help! That worked! Smiley Happy

Greg_Deckler
Community Champion
Community Champion

As a measure:

 

Measure 7 = RIGHT(MAX(Email[Column1]),LEN(MAX(Email[Column1]))-3)&"@xyz.com"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

I don't know, that worked for me as a column, are you trying to do this aas a measure?

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors