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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
NadeemAhamed
Helper IV
Helper IV

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

View solution in original post

4 REPLIES 4
NadeemAhamed
Helper IV
Helper IV

@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

@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  

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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