Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello folks,
I need to change the background color for alternate rows for country column. ex : Canada : Green, France : Blue, USA : Pink and Germany and Mexico should not change there background color. can anyone help on this. i tried with
#dax #powerbidesktop
Solved! Go to Solution.
You could adapt the following to meet your own requirements.
1. Select your table visual (step 1)
2. Select the formatting pane (step 2)
3. Expand the "Cell elements" section (step 3)
4. Select "Country" from the Series option (step 4)
5. Turn the "Background color" slider on (step 5)
6. From the "Background color" panel that displays, ensure the "Format style" is set to "Rules" (step 6)
7. Define the background colours you want by defining rules for the requisite countries (step 7)
8. Click the OK button (step 😎
9. Your table should now be formatted as required, as below.
Hope that helps.
If this answers your question, please mark as a solution so others can find.
hello @test_test
1. if you want to do with DAX, then create a new measure consist of your requirement.
Color Palette =
var _Country = SELECTEDVALUE('Table'[Country])
Return
IF(
_Country="Canada",
"#00FF00",
IF(
_Country="France",
"#0000FF",
IF(
_Country="United States of America",
"#FF00AA"
)))
2. as shown by @PowerBIDave , instead of using Rules, use Field Value in Format Style box. Then choose the measure created previously.
There you go, it will do conditional formating based on your DAX.
Hope this will help.
Thank you.
Thanks Mate, but it is manual process is there any way to acheive it with DAX ? because here are less rows say i have 20 rows adding rules for 20 rows is a tedious can't we do by dax any. appreicate your help
hello @test_test
1. if you want to do with DAX, then create a new measure consist of your requirement.
Color Palette =
var _Country = SELECTEDVALUE('Table'[Country])
Return
IF(
_Country="Canada",
"#00FF00",
IF(
_Country="France",
"#0000FF",
IF(
_Country="United States of America",
"#FF00AA"
)))
2. as shown by @PowerBIDave , instead of using Rules, use Field Value in Format Style box. Then choose the measure created previously.
There you go, it will do conditional formating based on your DAX.
Hope this will help.
Thank you.
You could adapt the following to meet your own requirements.
1. Select your table visual (step 1)
2. Select the formatting pane (step 2)
3. Expand the "Cell elements" section (step 3)
4. Select "Country" from the Series option (step 4)
5. Turn the "Background color" slider on (step 5)
6. From the "Background color" panel that displays, ensure the "Format style" is set to "Rules" (step 6)
7. Define the background colours you want by defining rules for the requisite countries (step 7)
8. Click the OK button (step 😎
9. Your table should now be formatted as required, as below.
Hope that helps.
If this answers your question, please mark as a solution so others can find.