Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

need help on conditional formatting

Here is my table visual, I want to apply conditional formatting to each row to see if we meet our target every month. I know field value might work, but I don't know how to set up a field value. Please help!!! My brain doesn't work LOL, I was stuck here for 2 days. Really need help.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I think if I can create a measure that only contains one row, then it's ok to use it to set up the field value. 

    here is my code. But I don't know why it affects all the rows.....

    color =
    VAR result =
    CALCULATE(SELECTEDVALUE('CORP KPIs'[NJan]), ALLSELECTED('CORP KPIs'[NJan]))
    VAR R =
    IF(result <= 225, "Green","red")
    return R
    • v-kkf-msft's avatar
      v-kkf-msft
      Community Support

      Hi Anonymous ,

       

      If your months are columns in the table, then you have to create separate measures for each month. Take January as an example.

       

      Jan_Color = 
      IF (
          SELECTEDVALUE ( 'CORP KPIs 1'[ID] ) = "CAPA aging",
          IF ( SUM ( 'CORP KPIs 1'[Jan] ) <= 225, "Green", "Red" )
      )

       

      If you want to do this in a measure, then you need to unpivot these month columns in Power Query and then create the measure.

       

      color = 
      IF (
          SELECTEDVALUE ( 'CORP KPIs 2'[ID] ) = "CAPA aging",
          IF ( SELECTEDVALUE ( 'CORP KPIs 2'[Value] ) <= 225, "Green", "Red" )
      )

       


      If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
      Best Regards,
      Winniz
      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

        Hi V,

        Thank you for reply this. 

        Do you know if there is a way to bold a single column?