Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Condtional Formatting Issue

Why does Power BI not let me conditional format something? It blurs out the metric I want to conditionally format.

 

10 Replies

  • Hey Anonymous,

     

    can you please explain what you mean by "conditional format" the measure.

     

    Do you want to use this measure to control the background color inside a table visual or do you want to control the background based on the values of the above measure.

    What visual are using and what conditional formatting are you going to use?

     

    Regards,

    Tom

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Tom! So what I did was create a calculation which will show the average amount of time it takes for folks to answer a phone call: 

      Avg Ans Time (Mins) =
      VAR hours =
      ROUNDDOWN'CallData'[AvgAnsTime] / 3600,0)
      VAR minutes =
      ROUNDDOWNMOD'CallData'[AvgAnsTime]3600) / 600)
      VAR seconds =
      INTMOD ('CallData'[AvgAnsTime]60) )
      RETURN
      FORMAT(hours"0") & ":"
      FORMAT(minutes"00") & ":"
      FORMAT(seconds"00")
       
      With the values of the calculation, I am looking to place them in a table which helps show the amount of time it will take by the time of the day and the date, and I am looking to conditionally format values that are above 15 minutes long. 

       

       

      • TomMartens's avatar
        TomMartens
        Super User

        Hey Anonymous ,

         

        this part of the measure 

        ...
        FORMAT(hours, "0") & ":"
        & FORMAT(minutes, "00") & ":"
        & FORMAT(seconds, "00")

        Turns the result into a string for this reason you can't the measue to trigger conditional formatting.

        You can do the following, create a second measure that represents the time value as a decimal.

        Then you can use Conditional formatting based on Rules:

        Select the measure that represents the time as a decimal value and create formatting rules accordingly.

         

        Hopefully, this provides what you are looking for and helps to tackle your challenge.

         

        Regards,

        Tom

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi! TomMartens 

       

      So I did 

      = FORMAT('CallData'[AvgTalkTime(Mins)], "Decimal Number")

       

      And it stayed the exact same as Text and blurs out the 2nd measure for conditional formatting

      • TomMartens's avatar
        TomMartens
        Super User

        Hey Anonymous ,

         

        this converts a text like "h:mm:ss" into a decimal of datatype DOUBLE: 

        Time to Decimal = Convert( TIMEVALUE("0:15:00") , DOUBLE )
         
        Regards,
        Tom