March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All,
I need help in color formatting in matrix view. I need different background colors for
1) Category is "Actual" and month is less than current month (Jan to May i.e all cells with value 200 in sample output)
2) Category is "Actual" and month is greater than current month (June to Dec i.e all cells with value 100 in sample output)
3) Category is "Budget" all months (Jan to Dec i.e all cells with value 110 in sample output)
Sample output -
Row Labels | Jan'22 | Feb'22 | Mar'22 | Apr'22 | May'22 | Jun'22 | Jul'22 | Aug'22 | Sep'22 | Oct'22 | Nov'22 | Dec'22 |
Actual | 200 | 200 | 200 | 200 | 200 | 100 | 100 | 100 | 100 | 100 | 100 | 100 |
Budget | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 | 110 |
Grand Total | 310 | 310 | 310 | 310 | 310 | 210 | 210 | 210 | 210 | 210 | 210 | 210 |
Sample data -
Category | Month | Amount |
Actual | Jan'22 | 200 |
Actual | Feb'22 | 200 |
Actual | Mar'22 | 200 |
Actual | Apr'22 | 200 |
Actual | May'22 | 200 |
Actual | Jun'22 | 100 |
Actual | Jul'22 | 100 |
Actual | Aug'22 | 100 |
Actual | Sep'22 | 100 |
Actual | Oct'22 | 100 |
Actual | Nov'22 | 100 |
Actual | Dec'22 | 100 |
Budget | Jan'22 | 110 |
Budget | Feb'22 | 110 |
Budget | Mar'22 | 110 |
Budget | Apr'22 | 110 |
Budget | May'22 | 110 |
Budget | Jun'22 | 110 |
Budget | Jul'22 | 110 |
Budget | Aug'22 | 110 |
Budget | Sep'22 | 110 |
Budget | Oct'22 | 110 |
Budget | Nov'22 | 110 |
Budget | Dec'22 | 110 |
Solved! Go to Solution.
Here is one way:
First, the model:
And the Measure for conditional formatting:
1) Backround Colour:
Colour code =
VAR _today = YEAR(TODAY()) * 100 + MONTH(TODAY())
RETURN
SWITCH(SELECTEDVALUE('Dim Category'[Category]),
"Actual",
IF(MAX('Dim Period'[YearMonth]) < _today, "Green", "Red"),
"Budget",
"Blue")
2: Text Colour:
TEXT COLOUR =
IF(ISINSCOPE('Dim Period'[Month]), "White")
I've attached the sample PBIX file
Proud to be a Super User!
Paul on Linkedin.
Here is one way:
First, the model:
And the Measure for conditional formatting:
1) Backround Colour:
Colour code =
VAR _today = YEAR(TODAY()) * 100 + MONTH(TODAY())
RETURN
SWITCH(SELECTEDVALUE('Dim Category'[Category]),
"Actual",
IF(MAX('Dim Period'[YearMonth]) < _today, "Green", "Red"),
"Budget",
"Blue")
2: Text Colour:
TEXT COLOUR =
IF(ISINSCOPE('Dim Period'[Month]), "White")
I've attached the sample PBIX file
Proud to be a Super User!
Paul on Linkedin.
@Gopinath_iyer , You need to create a color measure like this and use it in conditional formatting using the field value option
color =
var _change =Calculate(Sum(Table[Amount]), Table[Category]= "Actual") - Calculate(Sum(Table[Amount]), Table[Category]= "Budget")
return
SWITCH (
TRUE(),
_change > 0, "green",
_change = 0, "blue",
_change < 0, "red"
)
How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
87 | |
70 | |
51 |
User | Count |
---|---|
206 | |
150 | |
97 | |
78 | |
69 |