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

Join 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.

Reply
amol0512
Helper I
Helper I

Matrix Conditional formatting

Hi, I wanted to color format Avg volume for each team in a row. this is data is shiftwise team wise Avg volume. I want to color red green based on Row Total of Avg Volume # in in each row. Green if it's higher than previous Avg Volume # and Red if it's less than previous Avg Volume #. Please help. Thanks in advance. 

 

amol0512_0-1649696537187.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @amol0512 ,

 

You could create a measure to get the previous [time range] and then get the coresponding [avg volumn].

Something like below:

measure =
var pre_time = calculate(max([[time range]]),filter(allselected('table'),[time range]<selectedvalue([time range])))

var pre_avg = maxx(filter(allselected('table'),[time range] = pre_time&&[team]=selectedvalue(team)),[avg volumn])

return
if([avg volumn]>pre_avg,"green","red")

At last, add this measure to conditional formatting value.

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @amol0512 ,

 

You could create a measure to get the previous [time range] and then get the coresponding [avg volumn].

Something like below:

measure =
var pre_time = calculate(max([[time range]]),filter(allselected('table'),[time range]<selectedvalue([time range])))

var pre_avg = maxx(filter(allselected('table'),[time range] = pre_time&&[team]=selectedvalue(team)),[avg volumn])

return
if([avg volumn]>pre_avg,"green","red")

At last, add this measure to conditional formatting value.

 

Best Regards,

Jay

amitchandak
Super User
Super User

@amol0512 , if previous is based on time bucket. Make sure the time bucket is in dimension and not in fact. and then create rank on asc order of time.

 

then you can create measures like

Time Rank = RANKX(all('Time'),'Time'[Start Time],,ASC,Dense) //YYYYWW format
measures
This = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Time'),'Date'[Time Rank]=max('Time'[Time Rank])))
Last = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Time'),'Date'[Time Rank]=max('Time'[Time Rank])-1))

 

Color measures =

Switch(True() ,

[This] -[Last] < 0, "Red", "Green" )

 

use this measure in conditional formatting using the field value option

 

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

 

Rank-based TI , discussed here

Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.