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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
CetinT
Frequent Visitor

Using LEN in LEFT

Hi Everbody,


I want to count the characters in a column, subtract a certain number of characters from this number and then shorten it.
But it gives an error. Below is the DAX code I use. Is it possible for you to help?

LEFT(SALES[W_HOUSE]; LEN(SALES[W_HOUSE])-2)

 

1 ACCEPTED SOLUTION

Hi, @CetinT 

@CetinT 

create new calculated column

Column = LEFT('Table'[W_HOUSE],LEN('Table'[W_HOUSE])-2)

Dangar332_0-1698915486398.png

 

or YOU can create measure 

Measure = MAXX('Table',LEFT('Table'[W_HOUSE],LEN('Table'[W_HOUSE])-2))
Dangar332_1-1698915773216.png

 

 

View solution in original post

5 REPLIES 5
Dangar332
Super User
Super User

HI, @CetinT 

LEFT(SALES[W_HOUSE], LEN(SALES[W_HOUSE])-2)

use ( , )  instead of  ( ; )

Thanks for your suggestion. But due to the regional settings of my computer I have to use ( ; ).

Hi, @CetinT 

provide some sample data

 

You can find sample data below. I want to cut the last two characters.

 

W_HOUSERESULT
DOR00401DOR004
TIRDOR00501TIRDOR005
FDOR00601FDOR006

Hi, @CetinT 

@CetinT 

create new calculated column

Column = LEFT('Table'[W_HOUSE],LEN('Table'[W_HOUSE])-2)

Dangar332_0-1698915486398.png

 

or YOU can create measure 

Measure = MAXX('Table',LEFT('Table'[W_HOUSE],LEN('Table'[W_HOUSE])-2))
Dangar332_1-1698915773216.png

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.