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

Be 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

Reply
NadeemAhamed
Helper V
Helper V

Particular cell color based on month slicer

Dear Community.

 

I am trying to apply background color for particular row cell based on selected month slicer. (Apr to Mar)

Color: Light Green

 

Ex: 

If user has selected month 

Month: Apr

Particular Cell : Division:Admin 

 

Month: May

Particular Cell : Division: IT 

 

Month: Jun

Particular Cell : Division : Transport

 

....... till Mar Particular Cell will be going to change. 

 

applying row cell is possible through DAX but i am not getting how to apply color condition with multiple if condition where one by one if condition should be execute. 

 

Thank you in adavance. 

1 ACCEPTED SOLUTION

Hi @NadeemAhamed 
You can create DAX like below (note that I did it on the part of the months to show how it works + you need 2 measures one for plan and second for actual) :

plan color =
SWITCH(SELECTEDVALUE(Sheet1[Month ]),
"apr" ,
if(SELECTEDVALUE(Sheet1[Divison])= "Admin" , "Light Green","White"),
"May",
if(SELECTEDVALUE(Sheet1[Divison])= "IT" , "Light Green","White"),
"Jun",
if(SELECTEDVALUE(Sheet1[Divison])= "Tech park Dev" , "Light Green","White"),
"Jul",
if(SELECTEDVALUE(Sheet1[Divison])= "Admin" , "Light Green","White"),
"White")
Ritaf1983_0-1719297447517.png

Result:

Ritaf1983_1-1719297475226.pngRitaf1983_2-1719297491627.png

The pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

4 REPLIES 4
NadeemAhamed
Helper V
Helper V

@Ritaf1983 

 

Thank you for your valuable time to read and respond

 

Here i have attached the excel and pbix file for your reference. 

 

pbix : https://toyotsu.box.com/s/e034h1r83v4h37weej7hwgpurpb1b100

excel : https://toyotsu.box.com/s/s3f7z18rwbze0kauuzobz6u2u564fw2l

 

In excel where ever cell has colored similary i have to color the cells in power bi table or matrix based on month slicer. 

Hi @NadeemAhamed 
You can create DAX like below (note that I did it on the part of the months to show how it works + you need 2 measures one for plan and second for actual) :

plan color =
SWITCH(SELECTEDVALUE(Sheet1[Month ]),
"apr" ,
if(SELECTEDVALUE(Sheet1[Divison])= "Admin" , "Light Green","White"),
"May",
if(SELECTEDVALUE(Sheet1[Divison])= "IT" , "Light Green","White"),
"Jun",
if(SELECTEDVALUE(Sheet1[Divison])= "Tech park Dev" , "Light Green","White"),
"Jul",
if(SELECTEDVALUE(Sheet1[Divison])= "Admin" , "Light Green","White"),
"White")
Ritaf1983_0-1719297447517.png

Result:

Ritaf1983_1-1719297475226.pngRitaf1983_2-1719297491627.png

The pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

@Ritaf1983 

 

Is it possibile to apply the condition to two or three rows?

 

NadeemAhamed_0-1719323303585.png

 

 

Ritaf1983
Super User
Super User

Hi @NadeemAhamed 

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.