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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
1125NEWBIUSER
Helper I
Helper I

Remove trailing zeros only when there are three in a row

Hi All,

 

I am trying to add a column next to current column that will take our customer numbers and show them as is unless it ends in three 0's and if it does, I want to show without only the trailing 3 0's. I have been using trusty google and got the below DAX but when I add to my new column, I get syntax . Can someone take a look and see what I am doing incorrectly? Thanks, Chris

 
 
 

1125NEWBIUSER_3-1666283437339.png

 

1 ACCEPTED SOLUTION

Thank you @JorgePinho,

I just did this and and now getting another syntex error. My customer ID's are not only numberic but some have text. I am now getting error about issues converting field to value. Is this needed for what I am even trying to do? Any hints? Below is message now. Thanks! Chris

1125NEWBIUSER_0-1666284370165.png

 

View solution in original post

7 REPLIES 7
Keith-Sayer
Resolver I
Resolver I

Hi there,

 

It looks like you are using M (which would work in PowerQuery but not in the Power BI Desktop) when it's expecting DAX. Try replacing the text.end with "Right," the text.start with "left," and the text.length with "LEN." Keep in mind, this only works if your data is a text string. Make sure it's not formatting it as a number.

 

Then try this:

IF(
    RIGHT('Customer Table'[Disp #],3) ="000",
    LEFT('Customer Table'[Disp #],LEN('Customer Table'[Disp #])-3),
    'Customer Table'[Disp #]
)

 

 

deevaker
Resolver I
Resolver I

Hi Chris,
You can replace your functions as below
text.end to RIGHT
text.start to LEFT
text.len to LEN

 

let me know if that works


Thanks,
Deevaker Goel

+91-9711975011
deevaker@hotmail.com
https://www.linkedin.com/in/deevakerg/

JorgePinho
Solution Sage
Solution Sage

Hi @1125NEWBIUSER 

 

Use LEFT() https://learn.microsoft.com/pt-pt/dax/left-function-dax instead of Text.Start

Use RIGHT() https://learn.microsoft.com/pt-pt/dax/right-function-dax instead of Text.End

Use LEN() https://learn.microsoft.com/pt-pt/dax/len-function-dax instead of Text.Lenght

Note: The -3 should be after the closing bracket of LEN() 

Thank you @JorgePinho,

I just did this and and now getting another syntex error. My customer ID's are not only numberic but some have text. I am now getting error about issues converting field to value. Is this needed for what I am even trying to do? Any hints? Below is message now. Thanks! Chris

1125NEWBIUSER_0-1666284370165.png

 

as @JorgePinho mentioned, please use -3 out of len function please

Thank you, I missed that. By changing that did the trick!

Great

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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