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

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
Super User

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")

Result:

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
4 REPLIES 4
Helper IV

Thank you for your valuable time to read and respond

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

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

Super User

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")

Result:

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
Helper IV

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

Super User

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.

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

## Helpful resources

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

#### Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors