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
Hi ArchStanton
Assuming your MonthSort column contains values like 202401, 202402, etc., and your Month Number column contains values from 1 to 12, you can create a DAX measure as follows:
IsFutureMonth =
VAR CurrentMonth = YEAR(TODAY()) * 100 + MONTH(TODAY())
RETURN
IF(MAX('Calendar'[MonthSort]) > CurrentMonth, 1, 0)
- Go to the table visual where you want to apply the formatting.
- Select the column you want to format.
- Click on the dropdown arrow next to the column name and choose “Conditional formatting” > “Font color.”
- In the conditional formatting pane, choose “Field value” and select the measure IsFutureMonth.
- Set the color for 1 (future months) to red and 0 (current and past months) to black.
- ArchStanton1 year agoPower Participant
Thanks, unfortunately It won't accept anything in Field value:
- Bibiano_Geraldo1 year agoSuper User
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
- ArchStanton1 year agoPower Participant
Awesome, thanks for all of your help with this👍
- ArchStanton1 year agoPower Participant
I tried this and there is no formatting at all in the Original Forecast column: