Forum Discussion

Sania-F's avatar
Sania-F
Resolver I
2 years ago
Solved

hide complete text or partial text in textbox based on certain conditions

So, I had 2 requirements

 

1. If only one value is selected in slicer, Hide  all sentences that I had.

I had slicer called - Bucket. bucket values->  10M,20M,30M 

 

2. Show/hide complete or partial text in text box based on certain conditions.

 

-if country and industry both are not blank, show values for both 

-if country is blank, show industry values

-if industry both is blank, show country values  

- if country and industry both are blank, show blank

  • Hi,

     

    So here whats I Implemented.

     

    rev_Across_country_Industry_JoinTbl =

        var Bucket_Filter= HASONEFILTER(Bucket_Filter[Bucket])

        VAR Country_Industry =

            CONCATENATEX(

                FILTER(

                    VALUES( Country_Industry_CrossJoin[Country_Industry]),

                    [Rev] < -20 &&

                    [Rev%] < -0.06

                ),

                Country_Industry_CrossJoin[Country_Industry],

                ", "

            )

        VAR VIP_client=

             CONCATENATEX (

            FILTER (

                Client,

                client[Clientid] IN { 2,3 } &&

                [Rev] < -20 &&

                [Rev%] < -0.06

            ),

           client[clientName],

            ", "

        ) --& " account"

        RETURN

            --COuntry_industry

        if(HASONEFILTER(DimBucket[Bucket]), blank(),

             IF (

                NOT ISBLANK(Country_Industry) && NOT ISBLANK(VIP_client),

                "• Requiring attention country and industry " & Country_Industry & ", as well as the " & VIP_client & " account",

                    if(NOT ISBLANK(Country_Industry) &&  ISBLANK(VIP_client),

                    "• Requiring attention are/is the Country_Industry " & Country_Industry,

                        if(ISBLANK(Country_Industry) && NOT  ISBLANK(VIP_client),  "• Requiring attention are/is the " & VIP_client & " account",blank() )

                        )

               

            )

           

    )



    HASONEFILTER => to hide all sentences
    if conditions placed within one another carefully as the way I wanted them to be evaluated. If not placed properly they wont function as expected.

2 Replies

  • Hi,

     

    So here whats I Implemented.

     

    rev_Across_country_Industry_JoinTbl =

        var Bucket_Filter= HASONEFILTER(Bucket_Filter[Bucket])

        VAR Country_Industry =

            CONCATENATEX(

                FILTER(

                    VALUES( Country_Industry_CrossJoin[Country_Industry]),

                    [Rev] < -20 &&

                    [Rev%] < -0.06

                ),

                Country_Industry_CrossJoin[Country_Industry],

                ", "

            )

        VAR VIP_client=

             CONCATENATEX (

            FILTER (

                Client,

                client[Clientid] IN { 2,3 } &&

                [Rev] < -20 &&

                [Rev%] < -0.06

            ),

           client[clientName],

            ", "

        ) --& " account"

        RETURN

            --COuntry_industry

        if(HASONEFILTER(DimBucket[Bucket]), blank(),

             IF (

                NOT ISBLANK(Country_Industry) && NOT ISBLANK(VIP_client),

                "• Requiring attention country and industry " & Country_Industry & ", as well as the " & VIP_client & " account",

                    if(NOT ISBLANK(Country_Industry) &&  ISBLANK(VIP_client),

                    "• Requiring attention are/is the Country_Industry " & Country_Industry,

                        if(ISBLANK(Country_Industry) && NOT  ISBLANK(VIP_client),  "• Requiring attention are/is the " & VIP_client & " account",blank() )

                        )

               

            )

           

    )



    HASONEFILTER => to hide all sentences
    if conditions placed within one another carefully as the way I wanted them to be evaluated. If not placed properly they wont function as expected.

  • Sania-F , Create one or more measure like this and use in text box

     

    If(isfiltered(Table[Country]) && isfiltered(Table[Industry]) , [Bucket Value measure], blank())

     

    or

     

    If(not(Isblank(Max(Table[Country]))) && not(Isblank(Max(Table[Industry]))) , [Bucket Value measure], blank())