Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Conditional Format Dates in a column based on Date in a previous column

Hello, 

 

Firstly I am very new to PowerBI. I have been searching for a solution the following and cannot find anything, I am wondering if it is even possible?

 

Conditional Format Dates in a column based on Date in a previous column

 

I have two columns, I want to Conditional format column 2 if the date is greater(later) than Column 1 - I will then repeat this for each column (month) in the report to show an easy to view trend of date changes. 

 

Any help much appreciated

 

  • Hi JTurv,

    You could try below suggestions:

    My data sample

    id t1 t2
    1 1/1/2018 1/1/2019
    2 5/1/2019 3/2/2019
    3 6/1/2019 1/5/2019
    4 4/5/2019 8/10/2019
    5 6/15/2019 7/15/2019
    6 5/18/2019 5/18/2019

    Then I create a measure for conditional format

    Measure 2 = if(MIN(comparetime[t2])>=MIN(comparetime[t1]), "#d6b3f2","#f4f7c3")

    Set confidition format on ID like below

    Best Regards,
    Zoe Zhi

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

3 Replies

  • dax's avatar
    dax
    Icon for Community Support rankCommunity Support

    Hi JTurv,

    You could try below suggestions:

    My data sample

    id t1 t2
    1 1/1/2018 1/1/2019
    2 5/1/2019 3/2/2019
    3 6/1/2019 1/5/2019
    4 4/5/2019 8/10/2019
    5 6/15/2019 7/15/2019
    6 5/18/2019 5/18/2019

    Then I create a measure for conditional format

    Measure 2 = if(MIN(comparetime[t2])>=MIN(comparetime[t1]), "#d6b3f2","#f4f7c3")

    Set confidition format on ID like below

    Best Regards,
    Zoe Zhi

    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

      Thanks alot for this, exactly what I needed. 

       

      The only issue is I have to create a new measure to check each month against last month, I imagine it may be too complicated to create a single measure that could be applied to all date columns that would always check this months date against last months date?

      • Anonymous's avatar
        Anonymous
        Not applicable

        dax Thank you for your help previously. 

         

        Would there be any way to manipulate the code so that it checks each month against it's previous month in one measure? 

        This would negate having to make new measures to compare each month. 

         

        I have gone a slightly different route by having all my data in Matrix table

         

         

        My columns are essentially data capture dates (once a month), ordered by a sort order in the DataDateOrder_Lookup table. The values are the dates captured on those data dates. 

         

        What I'm trying to achieve is assess the value (Date) in each column (DataDate) and flag red if the date is greater that the previous month.