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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Extract character based on slicer selection

Hi team, I'm currently working on a scenario in Power BI where I'm aiming to dynamically calculate and display the length (number of characters) of the values in the first column within a dedicated column of the table visualization. This behavior should be triggered based on the user's selection in a slicer component. I have attached a screenshot below,Let's say we have col_1 and we need number of characters in col_2 based on slicer selection. If we enter 3 then col_2 will display only three characters from col_1pbi isssue.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_0-1709789202189.png

2.Create the table for slicer.

vjiewumsft_1-1709789214478.png

3.Drag the number into the slicer visual.

vjiewumsft_2-1709789229030.png

4.Create the new measure to filter. Drag the measure into the table visual.

Displayed Characters = 
VAR SelectedLength = SELECTEDVALUE('Table number'[Number of characters])
VAR character = SELECTEDVALUE('Table'[Column1])
VAR colum2 = LEFT(character, SelectedLength)
RETURN
    colum2

    colum2

vjiewumsft_3-1709789241913.png

5.Select the number in the slicer visual. The result is shown below.

vjiewumsft_4-1709789275695.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_0-1709789202189.png

2.Create the table for slicer.

vjiewumsft_1-1709789214478.png

3.Drag the number into the slicer visual.

vjiewumsft_2-1709789229030.png

4.Create the new measure to filter. Drag the measure into the table visual.

Displayed Characters = 
VAR SelectedLength = SELECTEDVALUE('Table number'[Number of characters])
VAR character = SELECTEDVALUE('Table'[Column1])
VAR colum2 = LEFT(character, SelectedLength)
RETURN
    colum2

    colum2

vjiewumsft_3-1709789241913.png

5.Select the number in the slicer visual. The result is shown below.

vjiewumsft_4-1709789275695.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

 

 

amitchandak
Super User
Super User

@Anonymous , For the slicer please use a numeric parameter, Assuming the Selected Parameter is parameter based selectedvalue(Parameter[Value])

 

Create a new measure =

Left(Max(Table[Col1]) , [Selected Parameter])

 

https://docs.microsoft.com/en-us/power-bi/desktop-what-if

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors