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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vsteinbahs
Helper I
Helper I

Conditional formatting of cell values in Matrix visual

Hi,

I'm trying to highlight cell background in the Matrix visual where cell value is greater then the previous value in the same row.  Is it possible to do in the current version of Power BI?  A screenshot of Matrix is attached to this post.  Any help is highly appreciated!

 

Matrix visualMatrix visual

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @vsteinbahs ,

You can create the following measure:

 

Measure =

var A = CALCULATE(SUM('Table'[Sales]))

var B = CALCULATE(SUM('Table'[Sales]),DATEADD('Table'[Date],-1,DAY))

return

IF(A > B,"#FFFF00",BLANK())

 

Then in Matrix Format, choose conditional format:

Matrix1.png,

 enable Background color and select ‘Advanced controls’:

Matrix2.png

choose Format by Field value and select previous measure under Based on filed

 

Here is the demo , please try it:

PBIX 

 

Best Regards,

Yingjie Li

 

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

View solution in original post

6 REPLIES 6
v-yingjl
Community Support
Community Support

Hi @vsteinbahs ,

You can create the following measure:

 

Measure =

var A = CALCULATE(SUM('Table'[Sales]))

var B = CALCULATE(SUM('Table'[Sales]),DATEADD('Table'[Date],-1,DAY))

return

IF(A > B,"#FFFF00",BLANK())

 

Then in Matrix Format, choose conditional format:

Matrix1.png,

 enable Background color and select ‘Advanced controls’:

Matrix2.png

choose Format by Field value and select previous measure under Based on filed

 

Here is the demo , please try it:

PBIX 

 

Best Regards,

Yingjie Li

 

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

Hi @v-yingjl ,

Thank you very much for your reply and examples.  I applied your suggested technique to my project, but the cell values in the row still didn't get highlighted as I was hoping. Per attached screenshot, you can see that the value of "72,210" on Feb 13th for table "adrmst" is higher then the previous value for the same record on Feb 12th.  As a brief background on this project, I'm taking a daily snapshots of the database table row count, and want to hightlight the ones where the value is changing and is higher than on the previous day.  I can send you my pbix file, if you don't mind to take a look at it.

 

Row cell value changes per dateRow cell value changes per date

Hello @v-yingjl ,

I figured out where the problem was and your suggested technigue of using a "measure" is working perfectly now.  Once again, thank you for your help and solution!  I learned quite a bit through this exercise 😀 👍

 

Here is a screenshot from Matrix visual with conditional formatting of cell values.

colored background for row cell value changes.jpg

 

amitchandak
Super User
Super User

You can use dif between this day ve previous days, You need to have a date table for the same.

sales =CALCULATE(SUM(Sales[Sales Amount]))

Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))

Change = [sales]-[Day behind Sales ]

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Thanks for your reply, I will check it out early next week and let you know how it goes.

danextian
Super User
Super User

You may use a time intelligence formula to calculate for the diffference between current and previous day.
DIFF =<measure> - Calculate(<measure>, previousday(table[date]))

in the conditional formatting box, there is an option to select another measure to format by instead of the actual measure being formatted.









Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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