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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Sylvine_Wyz
Helper IV
Helper IV

Delete last character

Hello,

I want to create a calculated column.

I'm looking to create a DAX formula that removes the last character.

Example :

order_reference_orderNew Order N°
WQ032060QWQ032060

 

I try the formula below but all "Q" are deleted.

New Order N° =
var Order_last_caracter = RIGHT('wyz_reporting bi_order'[order_reference_order],1)
return
IF(
    Order_last_caracter="Q",
   SUBSTITUTE(
       'wyz_reporting bi_order'[order_reference_order],RIGHT('wyz_reporting bi_order'[order_reference_order],1),"" ),
       Order_reference_order
)

Can you help me please ? 

Thanks 

Have a nice day 😄
1 ACCEPTED SOLUTION
Anonymous
Not applicable

IF(
RIGHT([order_reference_order], 1) = "Q",
LEFT([order_reference_order], LEN([order_reference_order]) - 1),
[order_reference_order]
)

 

 

Try this 🙂 remember to mark as solution if correct. Cheers

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Hello, the solution would be:

1) You calculate what the length of the field is by subtracting 1 (without the last character):

Length = len(order_reference_order)-1

2) Create the New Order Number field, collecting the number of characters indicated by the length:

New Order No. = left(order_reference_order,length)

Anything you tell me. Best regards,

Anonymous
Not applicable

IF(
RIGHT([order_reference_order], 1) = "Q",
LEFT([order_reference_order], LEN([order_reference_order]) - 1),
[order_reference_order]
)

 

 

Try this 🙂 remember to mark as solution if correct. Cheers

Hello @Anonymous , 

thanks for your help.
I tried your solution but there is an error message :
"Impossible to convert the value from text type to number type"

Have a nice day

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.