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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Color Coding measures in matrix row

Hi guys,

I need help with color coding my measure. So far i have tried maxx function and it doesn't seem to work.

My measure below:

 

ModifiedRevenue = 
//Determine the quarter week no
VAR TDDateWeekNo=[TodaysDate]
Var rowfiltercontext=max(Calendar_Data[Week No])


Var CurrentRevenue=
CALCULATE(
sum(Data[Revenue (Base)]),
FILTER(Data,Data[Category] <>"Won"),
FILTER(Data,Data[Category]<> "Lost"),
FILTER(Calendar_Data,Calendar_Data[Week No]>=TDDateWeekNo))



var lastrevenue= ""
var flag=TDDateWeekNo<=rowfiltercontext
return
if(flag,CurrentRevenue,lastrevenue) 

 


The matrix visual that is produces. The measure hides all the previous weeks sales data and only shows the sales in Week 12 and Week 13. I would like to highlight the max (green) and min (red) amount for each category. 

adrianchy_0-1639897428687.png


End results are as such:

Best Case Min $24,975 (Red) , Max $110,976 (Green)

Pipeline Min $ 12,008 (Red), Max $45,080 (Green)


Tqvm





7 REPLIES 7
amitchandak
Super User
Super User

@Anonymous , Create a measure like

 

Switch(True(),
[Best Case] = calculate(maxx(summarize(Table, Table[Category],Table[Month], "_1" [Best Case]),[_1]), allselected() ), "Green",
[Best Case] = calculate(Minx(summarize(Table, Table[Category],Table[Month], "_1" [Best Case]),[_1]), allselected() ), "Red",
"white"
)

 

 

Use the same in conditional formatting using field value option

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi Amit

Thanks for the reply. I understand that from that measure that you wrote it is by creating a custom table and then finding the min and max. 

Is there a way to do it with a measure ? (Eg: Using the modified revenue measure above) Instead of a table?

Thank you

Hi, @Anonymous 

 

Can you provide source data for the modified revenue measure for testing? It can be in excel format or a simple PBIX file with sensitive information removed in advance.

 

Looking forward to your reply.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Anonymous
Not applicable

Hi @v-zhangti  , 

Thank you for replying . Here is the link for the PBI file 



https://drive.google.com/file/d/1al_C1XXdaokTQqqdy_dJJTSzK_B7nrHJ/view?usp=sharing

Thank you

Hi, @Anonymous 

 

We can't install non-Microsoft licensed apps on our office computers, so they can't be unzipped. Can you pass the PBIX file separately, please.

 

Best Regards

Anonymous
Not applicable

Hi, @Anonymous 

 

I have tried to test it, Measure cannot output two results at the same time, such as sum value and color. So it is not possible to make changes in Measure ModifiedRevenue to achieve your needs at the same time.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors