Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
jagostinhoCT
Post Partisan
Post Partisan

change color of most recent bar only

Hello,

 

Is there a way to show the most recent bar in a different color?

 

Graphy is dynamic in a way that it keeps expanding and most recent bar is updated frequently.

 

Image is photoshoped to illustrate the idea.

Audits per month.png

 

thank you

 

1 ACCEPTED SOLUTION
v-caliao-msft
Employee
Employee

Hi @jagostinhoCT,

 

Create 3 calculated column.
MonthName2 = FORMAT('Date'[CalendarDate],"YYYYMM")
MaxMonth = MAX('Date'[MonthName2])
IsRecent = IF('Date'[MonthName2]='Date'[MaxMonth],"Y","N")

 

Then drag IsRecent column to Legend, then you can get the expected result.
Capture.PNGCapture1.PNGCapture2.PNG

Regards,

Charlie Liao

View solution in original post

5 REPLIES 5
v-caliao-msft
Employee
Employee

Hi @jagostinhoCT,

 

Create 3 calculated column.
MonthName2 = FORMAT('Date'[CalendarDate],"YYYYMM")
MaxMonth = MAX('Date'[MonthName2])
IsRecent = IF('Date'[MonthName2]='Date'[MaxMonth],"Y","N")

 

Then drag IsRecent column to Legend, then you can get the expected result.
Capture.PNGCapture1.PNGCapture2.PNG

Regards,

Charlie Liao

KGrice
Memorable Member
Memorable Member

@jagostinhoCT

 

@Habib is right that there is no native way to do this, i.e., through a setting on your chart. However, you can still make it happen. Let's say you have a Month column in your data, which I'm assuming you're using for your X axis. For my example, I'm using a date for Start of Month, formatted as Mmmm, YYYY. Add a new column like:

 

isMostRecentMonth = TableName[StartOfMonth] = MAX(TableName[StartOfMonth])

 

That will give you a True/False amount in your table, which you can use in your measures. So for your audits situation, you'd need three measures:

 

Audits = SUM(TableName[AuditCount])

Audits Prior Months = CALCULATE([Audits], NOT(TableName[isMostRecentMonth]))

Audits Current Month = CALCULATE([Audits], TableName[isMostRecentMonth])

 

 

Put the second and third measures on your chart values, and specify colors for each one. When you bring in data for the next month, everything will shift automatically.

Habib
Responsive Resident
Responsive Resident

Hi @KGrice

 

Thanks for sharing this way to handle the scenario but it will not help in longer run because, you will have two different measures for same measure and it will confuse users when they will be using tooltip or any other feature.

 

 

KGrice
Memorable Member
Memorable Member

@Habib. The possibility for user confusion is worth noting, but whether or not the solution would work depends on who's using the report and if the reason for the separate measures is communicated. If my CEO wants a dashboard that highlights the most recent month, I can tell him it's not possible, or I can tell him it's possible but the tooltip will be dependent on which column he hovers over. With well-named measures, it shouldn't be that big of a deal.

 

I think that what you've brought up is a good approach to follow for some general guidelines:

 

1. Is it possible to do?

2. Does it make sense to do it?

 

The great thing about Excel was that it was almost always possible to do something, even if it doesn't make sense for whatever reason. It's good to see that Power BI will hopefully follow that mentality as more features are added. Give us the tools and let the users decide what makes sense!

Habib
Responsive Resident
Responsive Resident

In current release its not possible. You have only two options, either go with default option or set category color explicitly. In that case for new category again default color will be added.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Users online (742)