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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

AshwinKulkarni
Advocate I
Advocate I

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"

)

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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