Forum Discussion

evano_oruvan's avatar
evano_oruvan
Frequent Visitor
3 years ago
Solved

conditional formatting based on text from data object on target column

 

i have this legend and a column named target in pbi, i would like to create conditional formatting based on data objects text and values and apply to that target column,

 

questions

1.how to create conditonal formatting based on text, tried isselcted could not get answers, please help for the above legend

2. is it possible to use measure for column without aggregation for conditional formatting.

 

thank you.

  • Try this ....

     

    Click here to download a solurtion 

     

    How it works ...

     

    Create a target table ...

     

     

     

    Creates an actutals table

     

    Build relationship

     

    Create dax measures

    Green RAG = "green"
    Amber RAG = "orange"
    Green RAG = "green"

     

    Actuals RAG =
    var greentarget = SELECTEDVALUE(Targets[Green])
    var redtarget = SELECTEDVALUE(Targets[Red])
    var actual = SUM(Acutals[Amount])
    RETURN
    SWITCH( TRUE(),
    actual >= greentarget, "Green",
    actual < redtarget, "Red",
    "Orange"
    )
     
    On the actuals visual clcik on the column
    In conditiomal formating select background colour 
    Format style = filed value / based on field =  Actuals RAG

     

     

     

     

    Thanks for reaching out for help.

    I put in a lot of effort to help you, now please quickly help me by giving kudos.

    Remember we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button. 

    If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me. 

    One question per ticket please. If you need to extend your request then please raise a new ticket.

    You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

     

3 Replies

  • Try this ....

     

    Click here to download a solurtion 

     

    How it works ...

     

    Create a target table ...

     

     

     

    Creates an actutals table

     

    Build relationship

     

    Create dax measures

    Green RAG = "green"
    Amber RAG = "orange"
    Green RAG = "green"

     

    Actuals RAG =
    var greentarget = SELECTEDVALUE(Targets[Green])
    var redtarget = SELECTEDVALUE(Targets[Red])
    var actual = SUM(Acutals[Amount])
    RETURN
    SWITCH( TRUE(),
    actual >= greentarget, "Green",
    actual < redtarget, "Red",
    "Orange"
    )
     
    On the actuals visual clcik on the column
    In conditiomal formating select background colour 
    Format style = filed value / based on field =  Actuals RAG

     

     

     

     

    Thanks for reaching out for help.

    I put in a lot of effort to help you, now please quickly help me by giving kudos.

    Remember we are unpaid volunteers and here to coach you with Power BI and DAX skills and techniques, not do the users job for them. So please click the thumbs up and accept as solution button. 

    If you give someone a fish then you only give them one meal, but if you teach them how to fish then they can feed themselves and teach others for a lifetime.  I prefer to teach members on this forum techniques rather give full solutions and do their job. You can then adapt the technique for your solution, learn some DAX skills for next time and soon become a Power BI Super User like me. 

    One question per ticket please. If you need to extend your request then please raise a new ticket.

    You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

     

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    evano_oruvan You would have to create a measure that returns a numeric value based on the text value. You have to use aggregation in measures that refer to columns but often you can use MIN or MAX and that works just fine.

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, evano_oruvan ;

    You could create a measure as follow:

    Measure = IF(SUM('Table'[target])>=RIGHT(MAX('Table'[green]),2)+0,"Green",
              IF(SUM('Table'[target])<RIGHT(MAX('Table'[red]),2)+0,"Red","yellow"))

    then  set conditional format.

    The final show:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.