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
Hello Friends,
I have a requirement where i need to show row wise conditional background color for percentage in Matrix table.
For instance :
I have a product column which contains A,B,C and it has month wise percentage values. Now my requirement is need to show 3 diffrent colours based on 3 criterias for each category,
For Product A if value lessthen 70% it should get Red, 80% Amber and greatehrthan 90% green
For Product B if value lessthen 60% it should get Red, 70% Amber and greatehrthan 80% green
For Product C if value lessthen 50% it should get Red, 60% Amber and greatehrthan 70% green
If anyone knows the answer please let me know.
Thanks in Advance
Solved! Go to Solution.
Hi @VamshiGoud ,
Thanks for @audreygerred's solution, that's greate. Since Power BI does not support conditional formatting for rows , as suggested by @audreygerred , you may choose between two options: 'using a measure to apply conditional filtering for background color' or 'transposing the table and then creating conditional formatting on the new columns'. Please allow me to add some specific steps to this,
Option1:using a measure to apply conditional filtering for background color
1\ I assume there is a table -MyTable
2\Add a new measrue
Measure = SWITCH(TRUE(),
MAX([Product]) = "A" && MAX([Value]) <= 0.7, "red",
MAX([Product]) = "A" && MAX([Value]) <= 0.8, "#ffbf00",
MAX([Product]) = "A" && MAX([Value]) <= 0.9, "Green",
MAX([Product]) = "B" && MAX([Value]) <= 0.6, "red",
MAX([Product]) = "B" && MAX([Value]) <= 0.7, "#ffbf00",
MAX([Product]) = "B" && MAX([Value]) <= 0.8, "Green",
MAX([Product]) = "C" && MAX([Value]) <= 0.5, "red",
MAX([Product]) = "C" && MAX([Value]) <= 0.6, "#ffbf00",
MAX([Product]) = "C" && MAX([Value]) <= 0.7, "Green"
)
3\Add a matrix table
4\Set Condition Formatting on Value
5\Result
Option2:transposing the table and then creating conditional formatting on the new columns
1\I assume there is a table(Power Query)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI3UAWSFmDSEkjG6kQrOcHFzeCyIHFnNHFTkHgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, #"Jan-2024" = _t, #"Feb-2024" = _t, #"March-2024" = _t]),
#"Demoted Headers" = Table.DemoteHeaders(Source),
#"Changed Type" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}}),
#"Transposed Table" = Table.Transpose(#"Changed Type"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Product", type date}, {"A", Percentage.Type}, {"B", Percentage.Type}, {"C", Percentage.Type}})
in
#"Changed Type1"
2\Set for Sum of A
3\For Sum of B
4\For Sum of C
5\Result
Best Regards,
Bof
Hi @VamshiGoud ,
Thanks for @audreygerred's solution, that's greate. Since Power BI does not support conditional formatting for rows , as suggested by @audreygerred , you may choose between two options: 'using a measure to apply conditional filtering for background color' or 'transposing the table and then creating conditional formatting on the new columns'. Please allow me to add some specific steps to this,
Option1:using a measure to apply conditional filtering for background color
1\ I assume there is a table -MyTable
2\Add a new measrue
Measure = SWITCH(TRUE(),
MAX([Product]) = "A" && MAX([Value]) <= 0.7, "red",
MAX([Product]) = "A" && MAX([Value]) <= 0.8, "#ffbf00",
MAX([Product]) = "A" && MAX([Value]) <= 0.9, "Green",
MAX([Product]) = "B" && MAX([Value]) <= 0.6, "red",
MAX([Product]) = "B" && MAX([Value]) <= 0.7, "#ffbf00",
MAX([Product]) = "B" && MAX([Value]) <= 0.8, "Green",
MAX([Product]) = "C" && MAX([Value]) <= 0.5, "red",
MAX([Product]) = "C" && MAX([Value]) <= 0.6, "#ffbf00",
MAX([Product]) = "C" && MAX([Value]) <= 0.7, "Green"
)
3\Add a matrix table
4\Set Condition Formatting on Value
5\Result
Option2:transposing the table and then creating conditional formatting on the new columns
1\I assume there is a table(Power Query)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI3UAWSFmDSEkjG6kQrOcHFzeCyIHFnNHFTkHgsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product = _t, #"Jan-2024" = _t, #"Feb-2024" = _t, #"March-2024" = _t]),
#"Demoted Headers" = Table.DemoteHeaders(Source),
#"Changed Type" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}}),
#"Transposed Table" = Table.Transpose(#"Changed Type"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Product", type date}, {"A", Percentage.Type}, {"B", Percentage.Type}, {"C", Percentage.Type}})
in
#"Changed Type1"
2\Set for Sum of A
3\For Sum of B
4\For Sum of C
5\Result
Best Regards,
Bof
Hello! You can take whatever measure you are using for the percentages and instead of putting your product field as the rows, months as teh columns and your measure in measure you can create a filtered measure for each of the products, then add each of the measures into your matrix and set it so that the values appear on rows instead of columns, then you can format each measure. This method allows you to format A, B, and C since they are each their own measure 🙂
Proud to be a Super User! | |
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 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |