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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sdobi05
Frequent Visitor

conditional value in slicer

Hi All, Below is my query :

i have two date column named as 'current date' and 'previous date' at ID column level. In a custom column i am comparing both the dates and if it does not match then i am changing the background color of both the dates value field.

Now, i want to give slicer where selected ID value should give only background color is applied.

This is how i am comparing both the dates :

Chkdate = 

var prevdate=calculate(min(prevDate))

var curdate = calculate(min(curDate))

return

if(prevdate<>curdate,"#ff7f7f"."#ffffff")

i am passing above Chkdate column in conditional formatting of my date columns.

 

 

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @sdobi05 ,

I just created a sample pbix file for you, please check if that is what you want.

conditional value in slicer.jpg

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@sdobi05 , based on what I got

 

with a date table, few options

 

Last Day = CALCULATE(Min(Table[Value]),dateadd('Date'[Date],-1,Day))

This Day = CALCULATE(Min(Table[Value]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(Min(Table[Value]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
Last Day = CALCULATE(Min(Table[Value]), previousday('Date'[Date]))

 

Color Measure

color = if([This Day] <> [Last Day] ,"#ff7f7f","#ffffff")

 

or

color = if([This Day] <> [Last Day] ,selectedvalue(Color[Color]), "#ffffff")  /// need to Slicer of hex color using an independent table 

Use in conditional formatting using "Field Value" Option

Anonymous
Not applicable

filterSlicer = 

var prevdate=calculate(min(prevDate))

var curdate = calculate(min(curDate))

return

if(prevdate<>curdate,1,0)

 

Use above dax measure as filter slicer pulling it to the filter pane and select the value should be eaqual or greater then 0 in th filter.(slicer) User will only see those values only where there is change in the background using same logic.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.