Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Conditional formatting based on date

Hello Everyone!

 

I am having some issues attempting to create a measure to conditionally format matrix columns based on date. 

 

Here is what I am trying to do:

In a Rolling 12 Month Sales visual, I would like to shade all cells where the month/year is before the Client's Go-Live Date, which in my visual ideally would look like this:

 

 

I created the following measure:

 

Before Go-Live = IF(MIN('Calendar'[Date])<MAX('Sales'[Actual Go-Live]),0,1)

And then set up the conditional formatting this way:

 

 

But the cells being shaded are those with a value only, and only in the same Month/Year as the client's Go-Live date. The preceding blank cells are not shaded. Here is the result when I turn it on:

 

 

How do I get all cells prior to the client's Go-Live date shaded?

 

Thank you!

 

6 Replies

  • Hi Anonymous ,

     

    Believe this is related with the fact that you have blanks and not 0 try to add a +0 to your measure and check if it works properly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      MFelix Thanks for the reply! I am not sure what you mean though: where exactly in the measure do I add "+0"?

       

      Thank you!

      • MFelix's avatar
        MFelix
        Super User

        Anonymous .

         

        Try to redo your measure

         

        Before Go-Live = IF(MIN('Calendar'[Date])<MAX('Sales'[Actual Go-Live]),0,1) + 0

         

        Be aware that not really sure if this will work, if you can share a sample file if it doesn't work would be helpfull to give you the correct answer.

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

    Hi Anonymous ,

     

    It seems that your measure didnt return a true value,can you show me your .pbix file?If it's not convenient ,can you take a screenshot of the columns which you put in the matrix visual?

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!
    • Anonymous's avatar
      Anonymous
      Not applicable

      v-kelly-msft 

      Hi Kelly! I am unable to share the pbix but here are some screenshots. The rows/columns/values for the matrix, the tables used, the relationship and the First 12 measure used in the table. Hope this helps, it is all I can provide. I appreciate it!