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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

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.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.