Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
Each month I am manually changing the font colour of the values below from red to black (red being future months).
I would like to do this automatically when we start a new month - how can I do this?
My data calendar has a MonthSort columns as well as a month number, the month sort consists of 202401, 202402 and so on and my month sort is just 1 to 12.
The measures i am currently using for the 3 columns are:
Original Forecast =
VAR _firstdate =
CALCULATE(MIN('Total Closures'[Month]),
FILTER('Modelling','Modelling'[Forecast] <> BLANK() )
)
RETURN
CALCULATE(
MIN('Modelling'[Forecast]),
FILTER ('Modelling', Modelling[Month] = _firstdate)
)
Actual incl Projected = SUM(Modelling[Actual & Projected])
% Difference2 =
([Actual incl Projected]-[Original Forecast]) / [Last Value Forecast]
I'd be grateful for any advice
Solved! Go to Solution.
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.
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"
)
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
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)
I tried this and there is no formatting at all in the Original Forecast column:
Thanks, unfortunately It won't accept anything in Field value:
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
Awesome, thanks for all of your help with this👍
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
68 | |
53 | |
39 | |
33 |
User | Count |
---|---|
71 | |
63 | |
57 | |
49 | |
46 |