Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Conditional Formatting using Dax for Transparency

Hello all,

In the report below I am using a DAX measure that returns the colour I want for a Shape/Button background. This way I can hide and unhide the Facebook, Twitter and Linkedin Icons.

 

In one case I have the background colors which "hides" the button and in the other case I have it transparent so it unhides and the user knows Facebook, Twitter or Linkedin is available. Code below:


I am applying the formula to the background for a button (While simultaneously having an action for URL) using conditional formatting on the Format by "Field Value" option.



What I want is to have the button partially transparent when the link is unavailable, I would do this by setting the first colour on the DAX code to "FBFBFB30". However, when I do this it becomes completely transparent (100%) instead of partially (30%).

Has anyone had this error before? Is there a workaround? Maybe a bug that should be fixed?

thanks all

9 Replies

  • KNP's avatar
    KNP
    Super User

    Hi Anonymous, 

     

    Not sure if this will help but I've had more luck using this format for colour formatting.

     

    "rgba(253, 196, 7,1)"
     
    Change the rgb to desired colour and the last number to '0.3' for transparency of 30%.
     
    Hope this helps.
     
    Regards,
    Kim

     

    • KNP's avatar
      KNP
      Super User

      Just realised how old the original post was. I should have replied to kurtschron not Anonymous.

  • v-xicai's avatar
    v-xicai
    Community Support

    Hi Anonymous ,

     

    You may try to change the function SELECTEDVALUE to ISFILTERED in your formula.

     

    Best Regards,

    Amy

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      The issue is not testing the condition, it is the returned value of the condition. 

      The condition returns TRUE. The outcome should be transparent.

      It is not. It is either 100% transparent or 0% even if you make if "#XXXXXX30" e.g.


      • Sreya's avatar
        Sreya
        Helper II

        v-xicai Hi, Can you please tell me, what is the data type of this transparency measure?

  • you need to use any chart like bar char and add any column or measure to the tooltip and in the background formatting add your measure and it will work

  • also, use CONTAINS instead of selectedvalue