cancel
Showing results 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

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.

1 ACCEPTED SOLUTION
Super User

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" ,
"May",
if(SELECTEDVALUE(Sheet1[Divison])= "IT" , "Light Green","White"),
"Jun",
if(SELECTEDVALUE(Sheet1[Divison])= "Tech park Dev" , "Light Green","White"),
"Jul",
"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

4 REPLIES 4
Helper IV

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

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" ,
"May",
if(SELECTEDVALUE(Sheet1[Divison])= "IT" , "Light Green","White"),
"Jun",
if(SELECTEDVALUE(Sheet1[Divison])= "Tech park Dev" , "Light Green","White"),
"Jul",
"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

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.