Forum Discussion
Want to apply Conditional Formatting on Matrix Visual
- 7 months ago
Hi ManasRout
Below asssumes that you are using a dedicated dates table and has been set as such.
Conditional formatting color = VAR _formatString = IF ( SELECTEDVALUE ( table[value] ) = "this value", "0%", "#,#" ) --replace with your actual format string formula VAR _prevMonth = CALCULATE ( [your measure], PREVIOUSMONTH ( DatesTable[Date] ) ) VAR _diff = [your measure] - _prevMonth VAR _color = IF ( _diff < 0, "red", "green" ) --replace with HEX, RGB or RGBA colors RETURN IF ( _formatString = "0%", _color )In conditional formatting dialog box, select Field Value as use the above formula.
If this doesn't work, please provide a sanitzied copy of your pbix (confidential data removed). You may post a link to a cloud storage.
- 7 months ago
Hi ManasRout ,
Thanks for reaching out to the Microsoft fabric community forum.Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI…Best Regards,
Community Support Team
Goal: Conditional formatting only for % values in Matrix >> Current Month vs Previous Month
1. Light Green if current > previous
2. Light Red otherwise
Step 1: Convert month_year text >> Date (you already did)
Example (calculated column):
---DAX---
MonthDate =
DATE(
RIGHT([month_year],4),
MONTH(DATEVALUE("01-" & LEFT([month_year],3) & "-2000")),
1
)
---DAX---
Step 2: Create numeric % measure (NOT text)
---DAX---
KPI_Value_Num =
VALUE(SUBSTITUTE([Value],"%","")) / 100
---DAX---
Step 3: Previous Month measure
---DAX---
KPI_Prev_Month =
CALCULATE(
[KPI_Value_Num],
DATEADD('Table'[MonthDate], -1, MONTH)
)
---DAX---
Step 4: Conditional formatting color measure
---DAX---
KPI_Color =
IF(
NOT ISBLANK([KPI_Prev_Month]) &&
[KPI_Value_Num] > [KPI_Prev_Month],
"#C6EFCE", -- light green
"#FFC7CE" -- light red
)
---DAX---
Step 5: Apply in Matrix
Matrix → Values
Conditional formatting → Background color
Format by: Field value
Based on field: KPI_Color
Apply only to Value column
Results:
Works even though rows/columns are text
Only % KPIs get colored
Current vs Previous month comparison works
No date table required (though recommended later)
=================================================================
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Jaywant Thorat | MCT | Data Analytics Coach
LinkedIn: https://www.linkedin.com/in/jaywantthorat/
Join #MissionPowerBIBharat = https://shorturl.at/5ViW9
#MissionPowerBIBharat
LIVE with Jaywant Thorat from 10 Jan 2026
8 Days | 8 Sessions | 1 hr daily | 100% Free
Hi JaywantThank you for providing this solution the value column contain different types of value so I have applied dynamic formatting to bring a single format but after following your steps it applied for all values like %types as well as Non %types I want only apply on %types of value also it coming all are light red still not working. Please let me know If I need to share anything else for better understanding my requirement.