Forum Discussion
Conditional Formatting
- 1 year ago
Hi, please follow these steps:
For table1 to see only future months, please create the following measure:IsFutureMonth = IF( LASTDATE('Date'[Date]) > EOMONTH(TODAY(),0), 1, 0 )For table2, to see only future and present month, please create the following measure:
IsFutureMonthPresent = IF( LASTDATE('Date'[Date]) >= EOMONTH(TODAY(),0), 1, 0 )Now lets format your visual.
Select your table1, and in the Values field, right click on desired measure and add a conditional formatting as shown bellow:
In the prompt, in format style, choose Rules based on isFutureMonth measure, and color red when the value is 1, make sure to choose number and not percent, as shown bellow:
Repeat this steps for other values that you want to format in your matrix, and for you table2, just format using the measure isFuturePresent.
Your final result should look like this:
Download the sample: Case Modelling - Copy
Thanks for the reply from Bibiano_Geraldo , please allow me to provide another insight:
Hi, ArchStanton
1.Firstly, I have created the following sample data based on your description:
2.Secondly, I have created the following measure to determine whether the current date meets the requirements:
MEASURE =
IF (
MONTH ( MAX ( 'Total Closures'[ Month] ) ) >= MONTH ( TODAY () )
|| YEAR ( MAX ( 'Total Closures'[ Month] ) ) > YEAR ( TODAY () ),
"red",
"black"
)
3.Next, modify the colours column by column in the position shown in the image below:
Note that every column in the visualization that you need to change color needs to be modified.
4.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- ArchStanton1 year ago
Power Participant
Hi, thanks for your reply.
Unfortunately its still not working.
My data model is a simple one:
The Month column in my date table is Text =
Month = FORMAT('Date'[Date], "MMM")and so I get this error message with your measure:
When I modify your measure to this then the formatting stays all black for the Original Forecast column:
Red or Black = IF ( MONTH ( MAX ( 'Date'[Date] ) ) >= MONTH ( TODAY () ) || YEAR ( MAX ( 'Date'[Date] ) ) > YEAR ( TODAY () ), "red", "black" )- Anonymous1 year agoNot applicable
Hi, ArchStanton
Thank you for your response.
As you suspected, we believe this issue might be caused by table relationships. We would appreciate it if you could provide your PBIX file so that we can tailor the solution based on your specific details.
We recommend uploading it to GitHub and sharing the link with us.When uploading a file, please be careful to delete sensitive information.
Looking forward to your reply.
Best Regards,
Leroy Lu
- ArchStanton1 year ago
Power Participant