Forum Discussion

kristi_in_heels's avatar
2 years ago
Solved

How to apply conditional format to a certain column, based on text in another column

I have a table which looks similar to the below.   PROJECT PHASE FORECAST PHASE 1 FORECAST PHASE 2 FORECAST PHASE 3 FORECAST PHASE 4 A PHASE 1 {DATE} {DATE} {DATE} {DATE} B PHAS...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi,kristi_in_heels I am glad to help you.
    Here are my suggestions.

    suggestion1:
    Create a corresponding measure for the corresponding columns

     

    M_PHASE2 = 
     SWITCH(TRUE(),
     MAX('ProjectTable'[PHASE])="PHASE 1",IF(SELECTEDVALUE(ProjectTable[FORECAST PHASE 2])<TODAY(),1,2),
    0
     )
    
    M_PHASE3 = 
     SWITCH(TRUE(),
     MAX('ProjectTable'[PHASE])="PHASE 2",IF(SELECTEDVALUE(ProjectTable[FORECAST PHASE 3])<TODAY(),1,2),
    0
     )
    
    M_PHASE4 = 
     SWITCH(TRUE(),
     MAX('ProjectTable'[PHASE])="PHASE 3",IF(SELECTEDVALUE(ProjectTable[FORECAST PHASE 4])<TODAY(),1,2),
    0
     )
    

    Use the corresponding Measure value for each column to set the background color of that column.

    suggestion2
    You can also apply a background color to newly created calculated columns by uniformly extracting the values of the columns that satisfy the conditions

    create calculate column

    Next Phase Date = 
    SWITCH(
        TRUE(),
        ProjectTable[PHASE] = "PHASE 1", ProjectTable[FORECAST PHASE 2],
        ProjectTable[PHASE] = "PHASE 2", ProjectTable[FORECAST PHASE 3],
        ProjectTable[PHASE] = "PHASE 3", ProjectTable[FORECAST PHASE 4],
        BLANK()
    )
    

    create measure:

    IF_expiration_date = 
    IF(MAX('ProjectTable'[Next Phase Date])<TODAY(),
    1,0)
    

     

    I hope my test results can bring you good ideas and you can choose the right way according to your needs

    I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

    Best Regards,

    Carson Jian,

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