Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

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_1

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

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

    1.Create the simple table.

    2.Create the table for slicer.

    3.Drag the number into the slicer visual.

    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

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

     

    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.

     

     

     

     

     

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

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

    1.Create the simple table.

    2.Create the table for slicer.

    3.Drag the number into the slicer visual.

    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

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

     

    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.