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
Sania-F
Resolver I
Resolver I

Hide part of text in text box based on value selected in slicer

HI All,

 

I have a size slicer. I have a text box with below static text and dynamically inserted values.

Net at []-30%

  • bucket size:">1M" bucket at []+10% , with india as outlier, " >100k -1M" bucket at net []+0.0% and "<100k" bucket at net []-20%.

Slicer has 3 values >1M, <100K, >100k-1M. 
Whenever  >1M is selected in slicer, the text part related to other 2 values should get hidden. 
Whenever  <100K is selected in slicer, the text part related to other 2 values should get hidden. 
Whenever  >100K- 1M is selected in slicer, the text part related to other 2 values should get hidden. 
Whenever any 2 values are selected , text part related to those 2 values should be visible and the other text part should hide.

1 ACCEPTED SOLUTION
Sania-F
Resolver I
Resolver I

after going crazy for a whole day, found a work around, thats a bit tedious.

1. dax To show text dynamically for bucket 1

bucket >1M Text1 =

VAR SelectedSize = SELECTEDVALUE(DimBucket[Size])

var a =IF(CONTAINSSTRING(

    CONCATENATEX(

        ALLSELECTED(DimBucket[Size]),DimBucket[Size],","),">1M"),

"True","False"

)

RETURN

--a

IF(

    a="True",

    "'>1M' bucket at ", --space is mandatory after "at" as I dont want to hard code space inside textbox.

    BLANK()

)

 

 

 

=======

 

2. Dax to fetch Positive values(to color it in green manually in text box)

bucket green >1M No =

VAR SelectedSize = SELECTEDVALUE(DimBucket[Size])

var a =IF(CONTAINSSTRING(

    CONCATENATEX(

        ALLSELECTED(DimBucket[Size]),DimBucket[Size],","),">1M"),

"True","False"

)

RETURN

--a

IF(

    a="True",

    if(

        [size%] > 0,CONCATENATE("+", FORMAT([size %], "0.0%")) ,blank()

            ),

    BLANK()

)

 

===========

3. DAX to fetch negative values(to be colored in red manually)

 

bucket % red >1M = 

VAR SelectedSize = SELECTEDVALUE(DimBucket[Size])

var a =IF(CONTAINSSTRING(

    CONCATENATEX(

        ALLSELECTED(DimBucket[Size],DimBucket[Size],","),">1M"),

"True","False"

)

RETURN

--a

IF(

    a="True",

    if(

        [size %] < 0, [size %] ,blank()

            ),

    BLANK()

)



So I had to create n no. of measures to show/hide text and numbers dynamically in text box as per slicer selection for each bucket(<100k, 100k-1M, >1M).

My text box is now made of all inserted values.

anyone has any better idea, let me  know.

thankyou.

View solution in original post

1 REPLY 1
Sania-F
Resolver I
Resolver I

after going crazy for a whole day, found a work around, thats a bit tedious.

1. dax To show text dynamically for bucket 1

bucket >1M Text1 =

VAR SelectedSize = SELECTEDVALUE(DimBucket[Size])

var a =IF(CONTAINSSTRING(

    CONCATENATEX(

        ALLSELECTED(DimBucket[Size]),DimBucket[Size],","),">1M"),

"True","False"

)

RETURN

--a

IF(

    a="True",

    "'>1M' bucket at ", --space is mandatory after "at" as I dont want to hard code space inside textbox.

    BLANK()

)

 

 

 

=======

 

2. Dax to fetch Positive values(to color it in green manually in text box)

bucket green >1M No =

VAR SelectedSize = SELECTEDVALUE(DimBucket[Size])

var a =IF(CONTAINSSTRING(

    CONCATENATEX(

        ALLSELECTED(DimBucket[Size]),DimBucket[Size],","),">1M"),

"True","False"

)

RETURN

--a

IF(

    a="True",

    if(

        [size%] > 0,CONCATENATE("+", FORMAT([size %], "0.0%")) ,blank()

            ),

    BLANK()

)

 

===========

3. DAX to fetch negative values(to be colored in red manually)

 

bucket % red >1M = 

VAR SelectedSize = SELECTEDVALUE(DimBucket[Size])

var a =IF(CONTAINSSTRING(

    CONCATENATEX(

        ALLSELECTED(DimBucket[Size],DimBucket[Size],","),">1M"),

"True","False"

)

RETURN

--a

IF(

    a="True",

    if(

        [size %] < 0, [size %] ,blank()

            ),

    BLANK()

)



So I had to create n no. of measures to show/hide text and numbers dynamically in text box as per slicer selection for each bucket(<100k, 100k-1M, >1M).

My text box is now made of all inserted values.

anyone has any better idea, let me  know.

thankyou.

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.