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
dw700d
Post Patron
Post Patron

automatically select latest date in slicer when value is not 0

Good day all,

 

I would like to have a slicer that  automatically selects the most recent date in my data set. For instance in the visual below the slicer should automatically select 12/31/22 since this is the most recent date. Once 1/31/23 is added the slicer should automatically select 1/31/23. What kind of measure can I create to accomplish this?

 

There is additional criteria that would be helpful if possible but if too complicated I don’t need to have. As you can see in the visual below 12/31/22 has a 0 entry. This means the data for 12/31/22 has not been loaded yet. I would like to have a slicer that automatically selects the latest date in my data set with a value other than 0. For instance in the visual below the slicer should automatically select 9/30/22 since 12/31/22 has a value of 0. Once 12/31/22 has a value other than 0 then the slicer will select 12/31/22. What kind of measure can I create to accomplish this?

 

 

dw700d_0-1668261510229.png

 

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

Hi @dw700d ,

 

Create a measure like below:

Measure = 
var maxnot0 = CALCULATE(MAX('Table'[date]),FILTER(ALLSELECTED('Table'),'Table'[value]<>0))
return
IF(SELECTEDVALUE('Table'[date])=maxnot0,1,0)

Add it to visual filter and set value = 1.

vjaywmsft_0-1669962676791.png

Please note that the slicer cannot be automatically selected at any time.

This method only makes the slicer to display the most recent date that is not 0.

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @dw700d ,

 

Create a measure like below:

Measure = 
var maxnot0 = CALCULATE(MAX('Table'[date]),FILTER(ALLSELECTED('Table'),'Table'[value]<>0))
return
IF(SELECTEDVALUE('Table'[date])=maxnot0,1,0)

Add it to visual filter and set value = 1.

vjaywmsft_0-1669962676791.png

Please note that the slicer cannot be automatically selected at any time.

This method only makes the slicer to display the most recent date that is not 0.

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
timg
Solution Sage
Solution Sage

Hi,

You could create a calculated column in which you replace the date with either  "Today" or "Other" based on the day it is (you can use TODAY() for this). If you then use this column as a slicer you can always filter your results based on the current day. Below I placed an example:

image.PNG

Hope that helps!

Regards,

 

Tim





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi

 

Use the sorted option wusing the 3 dots and choose sort descending

JamesFr06_0-1668265069701.png

 

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.