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
Anonymous
Not applicable

How to extract the first X characters + "..."

Hi, I would like to use this function to calculate a column: 

 

 

 

Shortened URLs (limited) = 
IF
( LEN
(LEFT('Google Search Console - Summarized'[shortened URLs],15)) < 15,
 LEFT('Google Search Console - Summarized'[shortened URLs],15),
  LEFT('Google Search Console - Summarized'[shortened URLs],15) + "...")

 

 

 

yet it tells me that expression can't use variant data type. Is there a workaround for this? 

AndrejBI_1-1615559798032.png

I would basically like to extract 15 characters,  and if the string is longer than 15, add "..." at the end. 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous I think it is the + in your formula instead of &.  Try it like this.

Column = 
VAR _Len = LEN ( 'Google Search Console - Summarized'[shortended URLs] )
VAR _URL = LEFT ( 'Google Search Console - Summarized'[shortended URLs],15)
VAR _Adder = IF ( _Len <= 15, "", "...")
RETURN _URL & _Adder

jdbuchanan71_0-1615560379102.png

 

View solution in original post

1 REPLY 1
jdbuchanan71
Super User
Super User

@Anonymous I think it is the + in your formula instead of &.  Try it like this.

Column = 
VAR _Len = LEN ( 'Google Search Console - Summarized'[shortended URLs] )
VAR _URL = LEFT ( 'Google Search Console - Summarized'[shortended URLs],15)
VAR _Adder = IF ( _Len <= 15, "", "...")
RETURN _URL & _Adder

jdbuchanan71_0-1615560379102.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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