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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
weijunawj
Frequent Visitor

conditional formatting to make card transparent for selected date in slicer

Hi, i have a slicer for datetime as shown below

weijunawj_0-1623234305594.png

i want to make a card transparent when i select a date any time from 4/1/2015 to 5/1/2015.

for other dates (e.g.  < 4/1/15 and >5/1/15) it will not turn transparent
this is the measure i wrote for the background color for the card and it does not work.

weijunawj_1-1623234464279.png

may i know whats the correct way to write the condition? thanks

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @weijunawj ,

The understanding is not detailed enough, now adjusted to:

Use the following measure:

color = IF(SELECTEDVALUE('Table'[Date])>=DATE("2015","1","4")&&SELECTEDVALUE('Table'[Date])<=DATE("2015","1","5"),"#F0F0F0","#000000")

 

configure like below:

vluwangmsft_0-1624332696953.png

 

Final get:

vluwangmsft_1-1624332716264.pngvluwangmsft_2-1624332726978.pngvluwangmsft_3-1624332736941.png

vluwangmsft_4-1624332745405.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

4 REPLIES 4
v-luwang-msft
Community Support
Community Support

Hi @weijunawj ,

The understanding is not detailed enough, now adjusted to:

Use the following measure:

color = IF(SELECTEDVALUE('Table'[Date])>=DATE("2015","1","4")&&SELECTEDVALUE('Table'[Date])<=DATE("2015","1","5"),"#F0F0F0","#000000")

 

configure like below:

vluwangmsft_0-1624332696953.png

 

Final get:

vluwangmsft_1-1624332716264.pngvluwangmsft_2-1624332726978.pngvluwangmsft_3-1624332736941.png

vluwangmsft_4-1624332745405.png

 

 

Wish it is helpful for you!

 

Best Regards

Lucien

v-luwang-msft
Community Support
Community Support

嗨 @weijunawj  ,

Test like the below:

color = IF(SELECTEDVALUE('DATE'[Date])=DATE("2015","3","1"),"#F0F0F0","000000")

configure like below:

v-luwang-msft_2-1623750687979.png

 

v-luwang-msft_0-1623750620537.pngv-luwang-msft_1-1623750645268.png

Wish it is helpful for you!

 

Best Regards

Lucien

Anonymous
Not applicable

Dax look fine.
You can try to apply both conditions in the Dax and give result as 1,2,3.
Then in data field apply conditional formatting on these results.

Hope this helps.

amitchandak
Super User
Super User

@weijunawj , seems fine, my be you need < or > in place of =

 

Switch( true() ,

selectedvalue(Table[Date]) < = date(2015,1,1) ,

"#FFFFFF00",

"#FFFFFF"

)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors